Revision a07f4bd0
Added by Dominic Cleal over 11 years ago
- ID a07f4bd0840e657f26fe2bbe18932a1bdb4554da
lib/proxy/puppet/environment.rb | ||
---|---|---|
|
||
def puppet_environments
|
||
Puppet.clear
|
||
if Puppet::PUPPETVERSION.to_i >= 3
|
||
# Used on Puppet 3.0, private method that clears the "initialized or
|
||
# not" state too, so a full config reload takes place and we pick up
|
||
# new environments
|
||
Puppet.settings.send(:clear_everything_for_tests)
|
||
end
|
||
|
||
Puppet[:config] = SETTINGS.puppet_conf if SETTINGS.puppet_conf
|
||
raise("Cannot read #{Puppet[:config]}") unless File.exist?(Puppet[:config])
|
||
logger.info "Reading environments from Puppet config file: #{Puppet[:config]}"
|
||
Puppet.parse_config
|
||
|
||
if Puppet::PUPPETVERSION.to_i >= 3
|
||
# Initializing Puppet directly and not via the Faces API, so indicate
|
||
# the run mode to parse [master]. Don't use --run_mode=master or
|
||
# bug #17492 is hit and Puppet can't parse it.
|
||
Puppet.settings.initialize_global_settings(['--config', Puppet[:config], '--run_mode' 'master'])
|
||
else
|
||
Puppet.parse_config
|
||
end
|
||
conf = Puppet.settings.instance_variable_get(:@values)
|
||
|
||
env = { }
|
Also available in: Unified diff
fixes #1915 - load environments from Puppet 3
Two changes to support loading environment settings from Puppet 3:
parsed in a puppetmaster context
a full reparsing of the config to pick up changes in environments (Puppet bug
#17783)