|
This happens whenever the existing environment doesn't match what the ENC sets, which is fine (names in this post have been changed):
Notice: Local environment: 'production' doesn't match server specified node environment 'realenv', switching agent to 'realenv'.
If I use "environment = otherrealenv" (something which exists) in the [agent] section of puppet.conf then I get the same error message, which is fine.
Notice: Local environment: 'otherrealenv' doesn't match server specified node environment 'realenv', switching agent to 'realenv'.
However, when I use an environment that has never existed or previously existed but was removed, things break.
Warning: Unable to fetch my node definition, but the agent run will continue: Warning: Find /puppet/v3/node/myhost.me.com?environment=fakeenv&configured_environment=fakeenv&t... resulted in 404 with the message: {"message":"Not Found: Could not find environment 'fakeenv'","issue_kind":"RUNTIME_ERROR"}
Info: Retrieving pluginfacts Error: /File[/opt/puppetlabs/puppet/cache/facts.d]: Could not evaluate: Could not retrieve information from environment fakeenv source(s) puppet:///pluginfacts Info: Retrieving plugin Error: /File[/opt/puppetlabs/puppet/cache/lib]: Could not evaluate: Could not retrieve information from environment fakeenv source(s) puppet:///plugins
(Many failing resources here.)
Error: Could not retrieve catalog from remote server: Find /puppet/v3/catalog/myhost.me.com?environment=fakeenv&facts_format=pson&facts=%257B... resulted in 404 with the message: {"message":"Not Found: Could not find environment 'fakeenv'","issue_kind":"RUNTIME_ERROR"}
The documentation seems to indicate that the ENC environment overrides the agent-requested environment. Not sure if that makes this a documentation bug or a puppet bug, but it's behaviour I did not expect.
https://docs.puppet.com/puppet/4.10/configuration.html#environment
https://docs.puppet.com/puppet/4.10/nodes_external.html#considerations-and-differences-from-node-definitions
"In Puppet 3 and later, ENCs can set an environment for a node, overriding whatever environment the node requested."
For use case background:
The informational message about how the current environment "doesn't match server specified node environment" was causing some consternation so I used the environment setting to make it go away. (Apparently it sounded like an error message.)
This breaks a bit when we have ephemeral environments; somebody may remove an environment (via r10k) but forget to change the ENC classification and do an agent run first. When they remove the environment before those steps the fix is to manually update puppet.conf to remove the environment line, which works against the lesson that people should only use puppet to update server configs.
|