Revision 41402094
Added by Ohad Levy about 12 years ago
- ID 41402094cecccc9d9c5fd674befdfe74ee617a85
config/initializers/foreman.rb | ||
---|---|---|
require 'foreman'
|
||
require 'puppet'
|
||
require 'puppet/rails'
|
||
# import settings file
|
||
SETTINGS= YAML.load_file("#{Rails.root}/config/settings.yaml")
|
||
|
||
SETTINGS[:version] = "0.5"
|
||
|
||
SETTINGS[:unattended] = SETTINGS[:unattended].nil? || SETTINGS[:unattended]
|
||
Puppet[:config] = SETTINGS[:puppetconfdir] || "/etc/puppet/puppet.conf"
|
||
Puppet.parse_config
|
||
$puppet = Puppet.settings.instance_variable_get(:@values) if Rails.env == "test"
|
||
SETTINGS[:login] ||= SETTINGS[:ldap]
|
||
|
||
begin
|
||
if SETTINGS[:unattended]
|
||
Bundler.setup(:virt)
|
||
require 'virt'
|
||
SETTINGS[:libvirt] = true
|
||
else
|
||
SETTINGS[:libvirt] = false
|
||
end
|
||
rescue LoadError
|
||
Rails.logger.debug "Libvirt binding are missing - hypervisor management is disabled"
|
||
SETTINGS[:libvirt] = false
|
||
end
|
||
|
||
# We load the default settings if they are not already present
|
||
Foreman::DefaultSettings::Loader.load
|
Also available in: Unified diff
removed puppet from Gem file requirement
this commit also tries to simplify the way we use bundler, in future commits,
we should add more logic of which gems to load based on configration file.