summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-05-12 18:32:39 -0700
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit342298c4f9fcb2874d4017219a472ddf37dbfc6b (patch)
tree88ce4cf98d858a595498825a60316c8de1178f87
parent6d5566a715c0b757480b1d321d5801b795470552 (diff)
downloadpuppet-342298c4f9fcb2874d4017219a472ddf37dbfc6b.tar.gz
puppet-342298c4f9fcb2874d4017219a472ddf37dbfc6b.tar.xz
puppet-342298c4f9fcb2874d4017219a472ddf37dbfc6b.zip
Bug: Broken codepath in util/settings
An incorrect variable name is used in an error message, causing the error to throw an error. This can't appear in the wild, since it's actually just an argument check for the defaults.rb file. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
-rw-r--r--lib/puppet/util/settings.rb2
-rwxr-xr-xspec/unit/util/settings.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb
index 4d5acbe5c..ea18d22bf 100644
--- a/lib/puppet/util/settings.rb
+++ b/lib/puppet/util/settings.rb
@@ -386,7 +386,7 @@ class Puppet::Util::Settings
when String, Integer, Float # nothing
klass = Setting
else
- raise Puppet::Error, "Invalid value '%s' for %s" % [value.inspect, hash[:name]]
+ raise ArgumentError, "Invalid value '%s' for %s" % [hash[:default].inspect, hash[:name]]
end
end
hash[:settings] = self
diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb
index 3eba6dd14..afdcf626a 100755
--- a/spec/unit/util/settings.rb
+++ b/spec/unit/util/settings.rb
@@ -38,6 +38,10 @@ describe Puppet::Util::Settings do
lambda { @settings.setdefaults(:section, :myvalue => {:default => "a value"}) }.should raise_error(ArgumentError)
end
+ it "should raise an error if we can't guess the type" do
+ lambda { @settings.setdefaults(:section, :myvalue => {:default => Object.new, :desc => "An impossible object"}) }.should raise_error(ArgumentError)
+ end
+
it "should support specifying owner, group, and mode when specifying files" do
@settings.setdefaults(:section, :myvalue => {:default => "/some/file", :owner => "service", :mode => "boo", :group => "service", :desc => "whatever"})
end