| 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]
|
|