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

Agent Filebucket operations fail after environment is overridden by ENC

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Template:

      Description

      Filebucket save operations fail if an agent environment specified via the command line or puppet.conf is overridden by the ENC.

      Reproduction Case

      • Install a PE 3.7.2 master and agent.
      • On the master, make an empty dev environment:

      mkdir -p /etc/puppetlabs/puppet/environments/dev
      

      • On the master, configure the deafult node in site.pp for the production environment to declare a single directory that purges contents. Any file created in this directory will be deleted by the agent and saved to the filebucket:

      # /etc/puppetlabs/puppet/environments/production/manifests/site.pp
       
      node default {
        file{'/tmp/bucket':
          ensure => directory,
          purge => true,
          recurse => true,
        }
      }
      

      • On the agent, create /tmp/bucket and place a file inside to be destroyed:

      mkdir -p /tmp/bucket
      touch /tmp/bucket/test
      

      • Execute an agent run with --environment=dev.

      Outcome

      The agent switches to the production environment specified by the ENC, but the filebucket operations fail complaining about a missing dev environment:

      # /opt/puppet/bin/puppet agent -t --environment=dev
       
      Warning: Local environment: "dev" doesn't match server specified node environment "production", switching agent to "production".
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Info: Caching catalog for pe-372-agent.puppetdebug.vlan
      Info: Applying configuration version '1430157143'
      Info: Computing checksum on file /tmp/bucket/test
      Error: Could not back up /tmp/bucket/test: Could not find a directory environment named 'dev' anywhere in the path: /etc/puppetlabs/puppet/environments. Does the directory exist?
      Error: Could not back up /tmp/bucket/test: Could not find a directory environment named 'dev' anywhere in the path: /etc/puppetlabs/puppet/environments. Does the directory exist?
      Error: /Stage[main]/Main/Node[default]/File[/tmp/bucket/test]/ensure: change from file to absent failed: Could not back up /tmp/bucket/test: Could not find a directory environment named 'dev' anywhere in the path: /etc/puppetlabs/puppet/environments. Does the directory exist?
      

      Expected Outcome

      The file is removed and sent to the filebucket as if --enviroment was never used:

      # /opt/puppet/bin/puppet agent -t
       
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Info: Caching catalog for pe-372-agent.puppetdebug.vlan
      Info: Applying configuration version '1430157218'
      Info: Computing checksum on file /tmp/bucket/test
      Info: /Stage[main]/Main/Node[default]/File[/tmp/bucket/test]: Filebucketed /tmp/bucket/test to main with sum d41d8cd98f00b204e9800998ecf8427e
      Notice: /Stage[main]/Main/Node[default]/File[/tmp/bucket/test]/ensure: removed
      Notice: Finished catalog run in 0.47 seconds
      

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  chuck Charlie Sharpsteen
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  8 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Zendesk Support