Project

General

Profile

Download (990 Bytes) Statistics
| Branch: | Tag: | Revision:
1462d569 Ohad Levy
require 'core_extensions'
9fd7478e Paul Kelly
require 'access_permissions'
e5224d76 Ohad Levy
require 'puppet'
b1a44209 Ohad Levy
require 'puppet/rails'
e5224d76 Ohad Levy
# import settings file
9c3ffb6b Ohad Levy
SETTINGS= YAML.load_file("#{RAILS_ROOT}/config/settings.yaml")
2dc34ac5 Ohad Levy
ddee8d43 Ohad Levy
SETTINGS[:version] = "0.3"
e5224d76 Ohad Levy
4dd720f6 Paul Kelly
SETTINGS[:unattended] = SETTINGS[:unattended].nil? || SETTINGS[:unattended]
9c3ffb6b Ohad Levy
Puppet[:config] = SETTINGS[:puppetconfdir] || "/etc/puppet/puppet.conf"
e5224d76 Ohad Levy
Puppet.parse_config
88693384 Lucas Tolchinsky
$puppet = Puppet.settings.instance_variable_get(:@values) if Rails.env == "test"
7a4ec5cf Paul Kelly
SETTINGS[:login] ||= SETTINGS[:ldap]

ba5b7e74 Ohad Levy
begin
c8ce839a Ohad Levy
if SETTINGS[:unattended]
require 'virt'
SETTINGS[:libvirt] = true
else
SETTINGS[:libvirt] = false
end
ba5b7e74 Ohad Levy
rescue LoadError
RAILS_DEFAULT_LOGGER.debug "Libvirt binding are missing - hypervisor management is disabled"
SETTINGS[:libvirt] = false
end

29eebabc Ohad Levy
# We load the default settings if they are not already present
1462d569 Ohad Levy
Foreman::DefaultSettings::Loader.load
29eebabc Ohad Levy
9fd7478e Paul Kelly
# We load the default settings for the roles if they are not already present
Foreman::DefaultData::Loader.load(false)