Reply
Highlighted
New Contributor
Posts: 3
Registered: ‎04-25-2019

can a backtick be used in a snippet?

I'd like to reference the hostname in an environment snippet. Is this possible? I tried:

 

FOO="... host=`hostname`"

 

However FOO results in the same string as above, without executing the hostname command

New Contributor
Posts: 3
Registered: ‎04-25-2019

Re: can a backtick be used in a snippet?

Replying to my own post, it appears the contents of the snippet value for environment variables is enclosed in single quotes. That's why the backtick command execution is not happening. So the question is - is there anyway to have dynamic values in enironment settings? For example, reference another environment variable, or use ` or $(...)

Posts: 1,028
Topics: 1
Kudos: 257
Solutions: 127
Registered: ‎04-22-2014

Re: can a backtick be used in a snippet?

@blong,

 

The real issue here is that CM writes all the environment variables you specify (and others determined internally) to a supervisor.conf file for that process.  The supervisord process then starts the process using supervisor.conf variables.

This means that it is the supervisord that needs to know how to set environment variables dynamically and I don't think that is a feature supported in supervisord at this time.

 

Depending on what you are trying to accomplish, there may be other ways to do this without environment variables.

New Contributor
Posts: 3
Registered: ‎04-25-2019

Re: can a backtick be used in a snippet?

Thanks for the response. I'm just trying to pass in a -D property to a HDFS process that includes the actual hostname of the server it's running on. Is there a way to make changes to HDFS startup scripts without breaking CM?

Cloudera Employee
Posts: 207
Registered: ‎01-15-2015

Re: can a backtick be used in a snippet?

There is no option to dynamically set options. Please explain what parameter you want to set explicitly to what value, and why this is needed.

Announcements