Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-3150

config_version setting in environment.conf uses relative pathing

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Fix
    • Affects Version/s: PUP 3.6.0
    • Fix Version/s: None
    • Component/s: DOCS
    • Labels:
      None
    • Template:

      Description

      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.

        Attachments

          Activity

          gary Gary Larizza created issue -
          joshua.partlow Joshua Partlow made changes -
          Field Original Value New Value
          Assignee Joshua Partlow [ joshua.partlow ]
          joshua.partlow Joshua Partlow made changes -
          Component/s DOCS [ 11226 ]
          Hide
          joshua.partlow Joshua Partlow added a comment -

          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)

          Show
          joshua.partlow Joshua Partlow added a comment - 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 )
          joshua.partlow Joshua Partlow made changes -
          Fix Version/s 3.7.2 [ 11925 ]
          Hide
          nick.fagerlund Nicholas Fagerlund added a comment -

          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.

          Show
          nick.fagerlund Nicholas Fagerlund added a comment - 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.
          Hide
          nick.fagerlund Nicholas Fagerlund added a comment -

          Docs updated, will build in about 15m.

          Show
          nick.fagerlund Nicholas Fagerlund added a comment - Docs updated, will build in about 15m.
          andy Andrew Parker made changes -
          Status Open [ 1 ] Ready for Engineering [ 10005 ]
          andy Andrew Parker made changes -
          Fix Version/s 3.7.2 [ 11925 ]
          Hide
          andy Andrew Parker added a comment -

          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.

          Show
          andy Andrew Parker added a comment - 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.
          andy Andrew Parker made changes -
          Status Ready for Engineering [ 10005 ] Closed [ 6 ]
          Resolution Won't Fix [ 2 ]
          kenn Kenn Hussey made changes -
          Workflow Platform Workflow [ 124608 ] Old Platform Workflow [ 187803 ]
          kenn Kenn Hussey made changes -
          Workflow Old Platform Workflow [ 187803 ] Platform Workflow [ 216040 ]
          kenn Kenn Hussey made changes -
          Workflow Platform Workflow [ 216040 ] Old Platform Workflow [ 247283 ]
          kenn Kenn Hussey made changes -
          Workflow Old Platform Workflow [ 247283 ] Platform Workflow [ 259044 ]
          kenn Kenn Hussey made changes -
          Workflow Platform Workflow [ 259044 ] Old Platform Workflow [ 305321 ]
          kenn Kenn Hussey made changes -
          Workflow Old Platform Workflow [ 305321 ] Platform Workflow [ 325683 ]
          kenn Kenn Hussey made changes -
          Workflow Platform Workflow [ 325683 ] Scrum Team Workflow [ 343772 ]
          derek.austin Dee Austin made changes -
          Workflow Scrum Team Workflow [ 343772 ] Scrum Teams Workflow [ 470463 ]
          kenn Kenn Hussey made changes -
          Workflow Scrum Teams Workflow [ 470463 ] Scrum Team Workflow [ 562605 ]

            People

            • Assignee:
              joshua.partlow Joshua Partlow
              Reporter:
              gary Gary Larizza
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support