summaryrefslogtreecommitdiffstats
path: root/lib/puppet/resource.rb
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-07-15 16:38:04 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-18 19:44:13 -0700
commitd319da41e46f0f3621180d09d3110f67003a7527 (patch)
treee69c8969dc25c2dd155ac49e2345e170830f5784 /lib/puppet/resource.rb
parent9f915402f5cf54c0f78dd34fefdde5f2f840cda7 (diff)
downloadpuppet-d319da41e46f0f3621180d09d3110f67003a7527.tar.gz
puppet-d319da41e46f0f3621180d09d3110f67003a7527.tar.xz
puppet-d319da41e46f0f3621180d09d3110f67003a7527.zip
[#4247] storeconfigs was calling Puppet::Parser::Resource.new with the wrong arguments
When the interface to Puppet::Resource changed, its subclass Puppet::Parser::Resource was also affected. One case of initializing those objects did not get updated when the code changed, causing storeconfigs to break. Also, this patch adds a error message that would have made it easier to catch this problem (as puppet could consume all memory and die trying to print the old error message)
Diffstat (limited to 'lib/puppet/resource.rb')
-rw-r--r--lib/puppet/resource.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb
index d163d93f0..55874aec8 100644
--- a/lib/puppet/resource.rb
+++ b/lib/puppet/resource.rb
@@ -409,6 +409,9 @@ class Puppet::Resource
if (argtitle || argtype) =~ /^([^\[\]]+)\[(.+)\]$/m then [ $1, $2 ]
elsif argtitle then [ argtype, argtitle ]
elsif argtype.is_a?(Puppet::Type) then [ argtype.class.name, argtype.title ]
+ elsif argtype.is_a?(Hash) then
+ raise ArgumentError, "Puppet::Resource.new does not take a hash as the first argument. "+
+ "Did you mean (#{(argtype[:type] || argtype["type"]).inspect}, #{(argtype[:title] || argtype["title"]).inspect }) ?"
else raise ArgumentError, "No title provided and #{argtype.inspect} is not a valid resource reference"
end
end