diff options
author | Henrik Lindberg <henrik.lindberg@cloudsmith.com> | 2014-09-06 00:14:15 +0200 |
---|---|---|
committer | Henrik Lindberg <henrik.lindberg@cloudsmith.com> | 2014-09-06 00:14:15 +0200 |
commit | 7a0a93701b42ce200baa5e5124bdbca506d38e23 (patch) | |
tree | d816cc346512d06a4b3fed971f60c06729e4cadc | |
parent | 1681684857c6e39d60d87b0b3520d8783977ceff (diff) | |
download | puppet-7a0a93701b42ce200baa5e5124bdbca506d38e23.tar.gz |
(PUP-3174) Make settings catalog skip manifestdir if environmentpath
This makes the settings catalog skip managment of manifestdir if
environmentpath is set.
-rw-r--r-- | lib/puppet/settings.rb | 9 | ||||
-rwxr-xr-x | spec/unit/settings_spec.rb | 8 |
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/puppet/settings.rb b/lib/puppet/settings.rb index 3201b125f..019f601a6 100644 --- a/lib/puppet/settings.rb +++ b/lib/puppet/settings.rb @@ -887,8 +887,8 @@ class Puppet::Settings sections = nil if sections.empty? catalog = Puppet::Resource::Catalog.new("Settings", Puppet::Node::Environment::NONE) - @config.keys.find_all { |key| @config[key].is_a?(FileSetting) }.each do |key| + next if (key == :manifestdir && should_skip_manifestdir?()) file = @config[key] next unless (sections.nil? or sections.include?(file.section)) next unless resource = file.to_resource @@ -905,6 +905,13 @@ class Puppet::Settings catalog end + def should_skip_manifestdir?() + setting = @config[:environmentpath] + !(setting.nil? || setting.value.nil? || setting.value.empty?) + end + + private :should_skip_manifestdir? + # Convert our list of config settings into a configuration file. def to_config str = %{The configuration file for #{Puppet.run_mode.name}. Note that this file diff --git a/spec/unit/settings_spec.rb b/spec/unit/settings_spec.rb index 0a1cee2bd..c0cd9e0aa 100755 --- a/spec/unit/settings_spec.rb +++ b/spec/unit/settings_spec.rb @@ -1338,6 +1338,14 @@ describe Puppet::Settings do @settings.to_catalog end + it "should ignore manifestdir if environmentpath is set" do + @settings.define_settings :main, + :manifestdir => { :type => :directory, :default => @prefix+"/manifestdir", :desc => "a" }, + :environmentpath => { :type => :path, :default => @prefix+"/envs", :desc => "a" } + catalog = @settings.to_catalog(:main) + catalog.resource(:file, @prefix+"/manifestdir").should be_nil + end + describe "on Microsoft Windows" do before :each do Puppet.features.stubs(:root?).returns true |