|
Puppet 5 fixed an issue where stale facts were used for catalog requests if a master had a cold cache (
PUP-3438
and
PUP-7198
). The fix was to merge facts submitted by the agent back into the node object instead of pulling facts from the cache. However, the merge is overwriting the environment returned by the ENC, which causes nodes to behave incorrectly if an environment fact is present.
-
-
Reproduction Case
-
Log into the PE console and verify that the classifier sets the master node environment to production via the "Production environment" Environment Group.
-
Copy the production environment to a new directory environment called facter_env:
cp -r /etc/puppetlabs/code/environments/production /etc/puppetlabs/code/environments/facter_env
|
chown -R pe-puppet /etc/puppetlabs/code/
|
-
Set environment and as an external fact:
mkdir -p /etc/facter/facts.d
|
|
cat << 'EOF' > /etc/facter/facts.d/facter_facts.txt
|
environment=facter_env
|
EOF
|
-
-
-
Outcome
The agent switches to facter_env despite the ENC setting:
[root@pe-201732-master production]# puppet agent -t
|
Info: Using configured environment 'production'
|
Info: Retrieving pluginfacts
|
Info: Retrieving plugin
|
Info: Loading facts
|
Info: Caching catalog for pe-201732-master.puppetdebug.vlan
|
|
Notice: Local environment: 'production' doesn't match server specified environment 'facter_env', restarting agent run with environment 'facter_env'
|
|
Info: Retrieving pluginfacts
|
Info: Retrieving plugin
|
Info: Loading facts
|
Info: Caching catalog for pe-201732-master.puppetdebug.vlan
|
Info: Applying configuration version '1512410109'
|
Notice: Applied catalog in 13.11 seconds
|
-
-
-
Expected Outcome
The agent should stay in production:
[root@pe-201732-master production]# puppet agent -t
|
|
Info: Using configured environment 'production'
|
|
Info: Retrieving pluginfacts
|
Info: Retrieving plugin
|
Info: Loading facts
|
Info: Caching catalog for pe-201732-master.puppetdebug.vlan
|
Info: Applying configuration version '1512409900'
|
Notice: Applied catalog in 12.26 seconds
|
|