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

Error running puppet with non-existent and non-default environment

    XMLWordPrintable

    Details

    • Template:
      PUP Bug Template
    • Acceptance Criteria:
      • `puppet config` does not fail when an environment is set on an agent.
      • Acceptance tests written
    • Sub-team:
    • Team:
      Platform Core
    • Story Points:
      5
    • Sprint:
      Platform Core KANBAN
    • CS Priority:
      Major
    • CS Frequency:
      4 - 50-90% of Customers
    • CS Severity:
      3 - Serious
    • CS Business Value:
      4 - $$$$$
    • CS Impact:
      While this issue isn't difficult for an experienced user to work around. For many new or non-english reading users the error may not be easily understood and breaks CLI usage of puppet on the node.
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      Certain puppet subcommands like `puppet help` and `puppet config` no longer require a local environment to exist in order to function. They will check for the local environment, but if it does not exist they will fall back to assuming the defined environment exists on the master filesystem.
      Show
      Certain puppet subcommands like `puppet help` and `puppet config` no longer require a local environment to exist in order to function. They will check for the local environment, but if it does not exist they will fall back to assuming the defined environment exists on the master filesystem.
    • QA Risk Assessment:
      Manual

      Description

      If no matching local $environment folder on agent, error when running any 'puppet config' or 'puppet module' command.
      See REPROs in comments below.

      For example, if you have an environment called 'dev' on the master, and you want to set an agent's $environment from the default of 'production' to 'dev', you might issue a puppet config set environment dev comand. When run, puppet config will look up the current environment ('production' at this point) and ensure there is a corresponding 'production' folder in the environments path. Assume this succeeds because a 'production' folder exists locally on the agent, by default, but NO OTHER environment folders exist locally on the agent (and shouldn't need to exist in my view).

      Now the environment is set to 'dev'.

      If a user issues any puppet config command at this point, the current environment ('dev' at this point) will NOT have a corresponding environment folder, so we get an error like:

      Could not find a directory environment named 'dev' anywhere in the path: /etc/puppetlabs/code/environments. Does the directory exist?
      

      [root@pup-vra7-0403 ~]# puppet config set environment production
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/environments.rb:38:in `get!': Could not find a directory environment named 'dev' anywhere in the path: /etc/puppetlabs/code/environments. Does the directory exist? (Puppet::Environments::EnvironmentNotFound)
      	from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application_support.rb:29:in `push_application_context'
      	from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:337:in `run'
      	from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:132:in `run'
      	from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:72:in `execute'
      	from /usr/local/bin/puppet:5:in `<main>'
      

      This means we're stuck and cannot issue any puppet config print or puppet config set commands even to get us back to an environment setting of 'production'!

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              eric.delaney Eric Delaney
              Reporter:
              jeremy Jeremy Adams
              Votes:
              3 Vote for this issue
              Watchers:
              25 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support