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

Built-in variable referring to the path of the current environment


    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Incomplete
    • Affects Version/s: PUP 3.7.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Template:


      $environmentpath permits a list of colon-separated directories in which environments will be searched, but there doesn't appear to be a way to detect which environment base directory was actually used.

      For example, in the config_version variable of environment,conf, when using git rev-parse to obtain the commit hash, it's only possible to do this when $environmentpath is a singular value, e.g.

      git --git-dir $environmentpath/$environment/.git rev-parse HEAD

      when $environmentpath is a list of directories this breaks for obvious reasons, and yet there doesn't seem to be a variable to tell you which of the multiple entries in $environmentpath ended up being used.

      The only workaround I can see is to point config_version at a script which takes $environmentpath and $environment as parameters and then reverse engineers the logic that puppet uses to locate the environment to use. This seems fragile. A much better option would be to have a built-in variable that resolves to the full path on the server containing the environment being used.

      Hopefully this will be trivial to implement.




            • Assignee:
              broberts Ben Roberts
              QA Contact:
              Kurt Wall
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created:

                Zendesk Support