Revision d58db757
Added by Dominic Cleal over 11 years ago
- ID d58db7573838c16005113e201833b535af90e6cf
lib/proxy/puppet/environment.rb | ||
---|---|---|
module Proxy::Puppet
|
||
|
||
require 'proxy/puppet/initializer'
|
||
require 'proxy/puppet/puppet_class'
|
||
require 'puppet'
|
||
|
||
... | ... | |
private
|
||
|
||
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
|
||
|
||
if SETTINGS.puppet_conf
|
||
Puppet[:config] = SETTINGS.puppet_conf
|
||
raise("Cannot read #{Puppet[:config]}") unless File.exist?(Puppet[:config])
|
||
elsif Puppet::PUPPETVERSION.to_i >= 3
|
||
Puppet[:config] = "/etc/puppet/puppet.conf"
|
||
end
|
||
logger.info "Reading environments from Puppet config file: #{Puppet[: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
|
||
Initializer.load
|
||
conf = Puppet.settings.instance_variable_get(:@values)
|
||
|
||
env = { }
|
Also available in: Unified diff
fixes #2085 - load Puppet 3 app defaults for master mode too
Allows $confdir and other run mode specific settings to be initialised from
the defaults present in Puppet::Util::RunMode. When requesting detail on
classes, the Puppet parser indirectly requests app level settings so both
global and app settings are needed. Refactored into shared code for both
parser and environments to use.