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

Catalogs are transformed to resources outside of node environments



    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • PUP 3.7.0
    • PUP 3.7.4
    • Compiler
    • 2
    • Language 2015-01-21, Language 2015-02-04


      The master prepares a catalog for transmission to an agent by transforming it using the to_resource method. This call occurs outside of the context containing the agent's environment. This means that any resource operations involving the environment will use the master's 'default' environmant (almost always production unless set otherwise in puppet.conf).

      The resolution to PUP-1381, released in 3.7.0, contains one such operation that involves the environment: a deprecation check. This check will force the default environment to load and can cause runs in other environments to fail if the default environment has any issues.

      Reproduction Case


      # puppet.conf
      environmentpath = /etc/puppet/environments
      environment = debug

      # Create invalid site.pp for production. Will fail to parse.
      echo "import '/tmp/bogus/*.pp'" > environments/production/manifests/site.pp
      # Create valid site.pp for debug environment.
      echo -e "node default{\nnotify{'hello, world':}\n}" > environments/debug/manifests/site.pp

      Start master and run puppet agent -t, the first run will fail with a message concerining the site.pp file in production. The second run will succeed due to environment caching.

      # puppet master --no-daemonize --logdest=/dev/null &
      [1] 25147
      # puppet agent -t --server=$(hostname -f)
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not
      parse for environment production: No file(s) found for import of '/tmp/bogus/*.pp'
      at /etc/puppet/environments/production/manifests/site.pp:2 on node poss-head-master.
      Warning: Not using cache on failed catalog
      Error: Could not retrieve catalog; skipping run
      # puppet agent -t --server=$(hostname -f)
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Info: Caching catalog for poss-head-master.puppetdebug.vlan
      Info: Applying configuration version '1418179472'
      Notice: hello, world
      Notice: /Stage[main]/Main/Node[default]/Notify[hello, world]/message: defined 'messa
      ge' as 'hello, world'
      Notice: Finished catalog run in 0.03 seconds

      In both cases, the catalog is compiled within the debug environment, but the error referencing production makes it hard to be sure of that without enabling and parsing a bunch of debug output.


        Issue Links



              Unassigned Unassigned
              chuck Charlie Sharpsteen
              Eric Thompson Eric Thompson
              0 Vote for this issue
              7 Start watching this issue



                Zendesk Support