[PUP-3150] config_version setting in environment.conf uses relative pathing Created: 2014/08/27  Updated: 2014/09/29  Resolved: 2014/09/29

Status: Closed
Project: Puppet
Component/s: DOCS
Affects Version/s: PUP 3.6.0
Fix Version/s: None

Type: Bug Priority: Normal
Reporter: Gary Larizza Assignee: Joshua Partlow
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified



If directory environments are configured, and you create an environment.conf in an environment, and you set the config_version parameter using a command that doesn't include the full path to the binary in question, such as:

config_version = 'git --git-dir $confdir/environments/$environment/.git rev-parse HEAD'

Puppet will attempt to look for the git binary in the relative environment path and produce the following error:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Execution of config_version command `/etc/puppetlabs/puppet/environments/production/git --git-dir /etc/puppetlabs/puppet/environments/production/.git rev-parse HEAD` failed: Execution of '/etc/puppetlabs/puppet/environments/production/git --git-dir /etc/puppetlabs/puppet/environments/production/.git rev-parse HEAD' returned 1:  on node master.puppetlabs.vm

I understand why relative pathing is important for modulepath, and I EVEN see why it's important if you wrap the command inside a script (so you can just drop the script inside the repository that's cloned to every environment), but using an inline command causes a problem. The benefit of using an inline command is that you can use $environment in the command (see above). If you use a script, you would need to pass the environment as an argument to the script to be able to use it (which is not too big of a problem).

I thought I'd raise the issue here for comment in case anyone else might have hit it.

Comment by Joshua Partlow [ 2014/09/16 ]

Talked with Andy about this for a bit this morning. We think the config_version should remain relative so that config_version scripts can be referenced within their environment without needing to know the absolute path to the environment. But it would make sense to update the docs for environment.conf config_version to point out that you will need to provide an absolute path to a system binary, or wrap it in a local script. Just something to help people who are trying a call like the git rev-parse mentioned in the description and are scratching their heads over why it's failing. (Though, actually, the error message is pretty straight-forward for once (Ping Nicholas Fagerlund)

Comment by Nicholas Fagerlund [ 2014/09/16 ]

Oh, lol, I hadn't thought about that interfering with the way we otherwise default to finding binaries in the PATH. Oh well, you should be using absolute paths to binaries anyway, who even knows what's in puppet's PATH in the first place. Yeah, I'll update the docs.

Comment by Nicholas Fagerlund [ 2014/09/16 ]

Docs updated, will build in about 15m.

Comment by Andrew Parker [ 2014/09/29 ]

Docs updated, behavior is a little surprising, but in order to be able to have config_version scripts in the environment, relative paths needs to be go to there.

Generated at Thu Apr 27 01:55:19 PDT 2017 using JIRA 6.4.14#64029-sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.