Puppet agent 8.22.2: changing ‘environment’ in pup...
# puppet
v
Puppet agent 8.22.2: changing ‘environment’ in puppet.conf under a running daemon leaves the old environment active for anything that relies on Puppet.lookup(:current_environment). How to reproduce: 1. Start the agent daemon with ‘environment = new’ in puppet.conf. 2. Remove the setting (server-specified environment is production). The daemon logs “Config file ... changed; triggering re-parse”. 3. Next run: catalog is requested and compiled in production, but concat_file’s eval_generate requests file_metadata/modules/nftables/config/puppet-inet-filter.nft?environment=new. If ‘new’ no longer exists on the server: 404, “Could not retrieve source(s)“. Cause (configurer.rb): after the re-parse, @environment = Puppet[:environment] is production, but push_current_environment_and_loaders isn’t called. The catalog environment matches @environment, the lastrunfile doesn’t trigger a switch, and :loaders already exists in the context. So :current_environment stays at the startup value, and Indirector::Request#environment falls back to it when no environment is passed.
j
Thanks @vchepkov, have you already filed this with the support team?
v
I didn’t. I would have submitted a fix if it was open source
j
If you can get it into an official customer support ticket that will really help give it some priority. Do you find the situation you are using this in to be something you see happen often? Changing the environment while it is still running?
v
no, just sandboxes. still a bug though
j
Yes, for sure, it should get fixed… I just know that depending on severity to the customer’s environment that will influence support ticket triage and escalation.
t
one of our PE customers changes environments while agent is running.
j
Thank you Martin! We should add them onto the ticket as extra context to help raise the priority. @vchepkov: Let me know the ticket number once you’ve submitted and I’ll get Martin’s customer info on there too.