Details
Description
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
Setup
# puppet.conf
|
[main]
|
environmentpath = /etc/puppet/environments
|
|
[agent]
|
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.
|
puppetdebug.vlan
|
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.
Attachments
Issue Links
- is cloned by
-
ENTERPRISE-441 Catalogs are transformed to resources outside of node environments
-
- Closed
-
- links to