summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/util/config.rb10
-rwxr-xr-xtest/util/config.rb32
2 files changed, 36 insertions, 6 deletions
diff --git a/lib/puppet/util/config.rb b/lib/puppet/util/config.rb
index afec4c943..7731fdc5b 100644
--- a/lib/puppet/util/config.rb
+++ b/lib/puppet/util/config.rb
@@ -301,13 +301,11 @@ class Puppet::Util::Config
end
values[section][var.to_s] = value
- # Do some annoying skullduggery here. This is so that
- # the group can be set in the config file. The problem
- # is that we're using the word 'group' twice, which is
- # confusing.
- if var == :group and section == Puppet[:name] and @config.include?(:group)
- @config[:group].value = value
+ # If the parameter is valid, then set it.
+ if section == Puppet[:name] and @config.include?(var)
+ @config[var].value = value
end
+ next
end
# Don't override set parameters, since the file is parsed
diff --git a/test/util/config.rb b/test/util/config.rb
index 58f74f5c9..742b15b7b 100755
--- a/test/util/config.rb
+++ b/test/util/config.rb
@@ -1026,6 +1026,38 @@ inttest = 27
check.call("750", 0750)
end
+
+ def test_only_set_metas_when_valid
+ file = tempfile
+ config = tempfile
+ @config.setdefaults(Puppet[:name], :ssldir => {
+ :mode => 0644,
+ :group => "yayness",
+ :desc => "yay",
+ :default => "/some/file"})
+
+ File.open(config, "w") { |f| f.puts "[#{Puppet[:name]}]
+ mode = 750
+ group = foo
+ ssldir = #{file}
+ "}
+
+ assert_nothing_raised do
+ @config.parse(config)
+ end
+
+ assert_raise(ArgumentError) do
+ @config[:mode]
+ end
+ assert_raise(ArgumentError) do
+ @config[:group]
+ end
+
+ # Now make them valid params
+ @config.setdefaults(Puppet[:name], :group => ["blah", "yay"])
+ @config.setdefaults(Puppet[:name], :mode => ["755", "yay"])
+
+ end
end
# $Id$