Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
None
-
Night's Watch
-
3
-
NW - 2021-07-14, NW - 2021-07-28
-
Needs Assessment
-
Bug Fix
-
Fixed a bug where an old environment could be used if the environment has changed due to pluginsync.
-
Needs Assessment
Description
At the start of the configurer run, puppet pushes its configured environment (from Puppet[:environment]) or the server-specified environment (from the ENC) onto the context in https://github.com/puppetlabs/puppet/blob/6.13.0/lib/puppet/configurer.rb#L319-L331
However, if pluginsync causes environment to change, then the agent switches to the new environment, but Puppet.lookup(:current_environment) still returns old value, while Puppet::Resource::Catalog#environment returns the new value:
$ bx puppet agent -t
|
Info: Using configured environment 'production'
|
Info: Retrieving pluginfacts
|
Info: Retrieving plugin
|
Info: Retrieving locales
|
Notice: Local environment: 'production' doesn't match server specified environment 'dev', restarting agent run with environment 'dev'
|
Info: Retrieving pluginfacts
|
Info: Retrieving plugin
|
Info: Retrieving locales
|
Info: Caching catalog for XXX
|
Info: Applying configuration version '1582308523'
|
|
[261, 270] in /Users/josh/work/puppet/lib/puppet/type/file/source.rb
|
261: end
|
262: end
|
263:
|
264: def each_chunk_from
|
265: require 'byebug'; byebug
|
=> 266: if Puppet[:default_file_terminus] == :file_server && scheme == 'puppet' && (uri.host.nil? || uri.host.empty?)
|
267: chunk_file_from_disk(metadata.path) { |chunk| yield chunk }
|
268: elsif local?
|
269: chunk_file_from_disk(full_path) { |chunk| yield chunk }
|
270: else
|
(byebug) Puppet.lookup(:current_environment)
|
<Puppet::Node::Environment::Remote:70205531253460 @name="production" @manifest="no_manifest" @modulepath="" >
|
(byebug) resource.catalog.environment
|
"dev"
|
Puppet relies on the catalog's environment being correct when retrieving file metadata & content, such as https://github.com/puppetlabs/puppet/blob/6.13.0/lib/puppet/type/file/source.rb#L194
Attachments
Issue Links
- relates to
-
PUP-9570 Catalog failure on first run due to pluginsync and environment switch
-
- Resolved
-