Support Questions

Find answers, ask questions, and share your expertise

Using include statement in Cloudera Director HOCON config to import customer properties

avatar
Rising Star

Hello.

 

We are using Cloudera Director 2.6.0 to deploy our clusters.

 

Currently, we define customer specific parameters at the top of the customer config file like so:

 

customer-params {
name: "customerX"
environmentName: "customerX Environment"
subnetId: "subnet-cjkkd00se"
securityGroupsIds: "sg-1se36d6c,sg-c8f372ba"
dbHost: "customerX-postgres.cesosptkafdpf.us-east-1.rds.amazonaws.com"
dbUser: postgres

...

...

}

 

Further down in the file, we reference these configs like so:

 

name: ${customer-params.name}
environmentName: ${customer-params.environmentName}

 

This works like a charm, but we would prefer to manage customer specific settings separate from the client config file.

 

According to HOCON spec, we should be able to include these customer specifc settings like so:

 

include required(file("customer.properties"))

or

include file("customer.properties")

 

Has anyone confirmed that this works?  Using required throws the following error in the director client application.log:

 

[2017-10-20 14:46:04.600 -0400] ERROR [main] - com.cloudera.launchpad.Application: Failed to initialize application context
com.typesafe.config.ConfigException$Parse: customer-config/c32/c32.conf: 1: expecting include parameter to be quoted filename, file(), classpath(), or url(). No spaces are allowed before the open paren. Not expecting: 'required(file('

 

Removing the "required" directive gets rid of this error, but then we run into errors trying to resolve the substitutions - which leads me to think our properties file isn't getting included.  

 

Are there any examples of this that I can reference. Anyone else had luck doing this?

1 ACCEPTED SOLUTION

avatar
Contributor

try

include "someother.conf"

View solution in original post

3 REPLIES 3

avatar
Contributor

try

include "someother.conf"

avatar
Rising Star

Thanks lyin.  That did the trick.  Any reason why the spec syntax did not work?  Is there another HOCON spec out there that I should be referencing? 

 

 

avatar
Rising Star

include file(...) should work but I believe it requires the full file path.

 

The current latest version of Director (Director 2.6) is on typesafe config version 1.2 which doens't have support for required. You can refer to the following spec to see what's supported in this verison: https://github.com/lightbend/config/blob/v1.2.0/HOCON.md