Revision 1c60be63
Added by Greg Sutcliffe almost 11 years ago
- ID 1c60be634d26163cc7fe43f5adad1f9f75c3309d
lib/proxy/puppet/environment.rb | ||
---|---|---|
env[:production] = conf[:main][:modulepath] || conf[:master][:modulepath] || '/etc/puppet/modules'
|
||
logger.warn "No environments found - falling back to defaults (production - #{env[:production]})"
|
||
end
|
||
if env.size == 1 and env.keys.first == :master and !env.values.first.include?('$environment')
|
||
# If we only have an entry in [master] it should really be called production
|
||
logger.warn "Re-writing single 'master' environment as 'production'"
|
||
env[:production] = env[:master]
|
||
env.delete :master
|
||
end
|
||
|
||
new_env = env.clone
|
||
# are we using dynamic puppet environments?
|
test/puppet_environment_test.rb | ||
---|---|---|
assert_array_equal env.map { |e| e.name }, ['production']
|
||
end
|
||
|
||
def test_master_is_remapped_to_production_when_solo
|
||
config = {
|
||
:main => {},
|
||
:master => { :modulepath=>'./test/fixtures/environments/prod' }
|
||
}
|
||
Puppet.settings.stubs(:instance_variable_get).returns(config)
|
||
env = Proxy::Puppet::Environment.all
|
||
assert_array_equal env.map { |e| e.name }, ['production']
|
||
end
|
||
|
||
def test_multiple_static_env
|
||
config = {
|
||
:main => {},
|
Also available in: Unified diff
Fixes #2654 - Rewrite master as production when only one environment is found