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

Can't run puppet resource on agent with environment specified in main section

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • PUP 4.5.2
    • PUP 6.24.0, PUP 7.9.0
    • None
    • Normal
    • 2 - 5-25% of Customers
    • 2 - Annoyance
    • 1 - ?
    • Hide
      When these four things are true, the user can't use puppet client commands on their nodes as expected:
      1. Code manager with separate environments
      2. Nodes in an environment other than production
      3. Mcollective in use
      4. environment=[non-production] specified in [main] section of puppet.conf

      The have to do mental gymnastics to understand why they must add --environment production to every puppet help, puppet resource, etc. command to make it work.
      Show
      When these four things are true, the user can't use puppet client commands on their nodes as expected: 1. Code manager with separate environments 2. Nodes in an environment other than production 3. Mcollective in use 4. environment=[non-production] specified in [main] section of puppet.conf The have to do mental gymnastics to understand why they must add --environment production to every puppet help, puppet resource, etc. command to make it work.
    • Bug Fix
    • Previously, running `puppet resource` with an invalid environment would fail the run. Now, the application will fall back to the default environment if the given one does not exist.

    Description

      See also https://tickets.puppetlabs.com/browse/PUP-6048

      Given a traditional Prod, Dev, Test scenario, and a desire to use MCollective
      Given the desire to configure an environment in the agent's puppet.conf to cut down on log messages
      Given the need to put the environment setting in [main] and not [agent] so that MCollective also knows the environment

      If one manually runs puppet commands on a non-production node, such as puppet resource, one gets an error:

      [root@dev-node ~]# puppet resource service puppet ensure=running enable=true
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/environments.rb:38:in `get!': Could not find a directory environment named 'development' 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:128: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>'

      However, if one impersonates the production environment, it works as expected:

      [root@dev-node ~]# puppet resource service puppet ensure=running enable=true --environment production
      Notice: /Service[puppet]/ensure: ensure changed 'stopped' to 'running'
      service

      { 'puppet': ensure => 'running', enable => 'true', }

      This inconsistency is frustrating to customers, regardless of the reasoning behind it. It requires retraining of their staff doing manual operations and lots of comments in their cron jobs, etc.

      Attachments

        Issue Links

          Activity

            People

              gabriel.nagy Gabriel Nagy
              paul.anderson Paul Anderson
              Votes:
              2 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support