Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
None
-
Night's Watch
-
2
-
NW - 2021-06-30, NW - 2021-07-14, NW - 2021-07-28, NW - 2021-08-11
-
Needs Assessment
-
Bug Fix
-
Fixes a bug that could result in puppet caching duplicate copies of an environment.
-
Needs Assessment
Description
The Puppet::Environments::Cached#get method says it accepts Strings or Symbols, but it doesn't normalize the name when getting/setting the environment in the cache. So you can end up caching environments for "production" and :production.
Agent side we lookup the environment based on the Puppet[:environment] setting. Server side we lookup the environment from a query parameter. But there are other entry points like Bolt and non-indirected REST APIs, so it would be good to fix this.
require 'puppet' |
Puppet.initialize_settings
|
Puppet::Util::Log.newdestination(:console) |
Puppet::ApplicationSupport.push_application_context(Puppet::Util::RunMode[:user]) |
envs = Puppet.lookup(:environments) |
envs.get!('production') |
envs.get!(:production) |
pp envs.instance_variable_get(:@cache).keys |
$ bx ruby cache.rb
|
["production", :production]
|