Project

General

Profile

Download (1005 Bytes) Statistics
| Branch: | Tag: | Revision:
d58db757 Dominic Cleal
module Proxy::Puppet

require 'puppet'

class Initializer
extend Proxy::Log

class << self
def load
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

597ab3ab Dominic Cleal
Puppet[:config] = config
raise("Cannot read #{config}") unless File.exist?(config)
logger.info "Initializing from Puppet config file: #{config}"
d58db757 Dominic Cleal
if Puppet::PUPPETVERSION.to_i >= 3
1dc369d4 Dominic Cleal
Puppet.initialize_settings
d58db757 Dominic Cleal
else
Puppet.parse_config
end
aff8fa8b Dominic Cleal
# Don't follow imports, the proxy scans for .pp files itself
Puppet[:ignoreimport] = true
d58db757 Dominic Cleal
end
597ab3ab Dominic Cleal
def config
SETTINGS.puppet_conf || File.join(SETTINGS.puppetdir || '/etc/puppet', 'puppet.conf')
end
d58db757 Dominic Cleal
end

end
end