summaryrefslogtreecommitdiffstats
path: root/lib/puppet/resource.rb
diff options
context:
space:
mode:
authorDan Bode <bodepd@gmail.com>2011-01-11 20:00:32 -0600
committerDan Bode <bodepd@gmail.com>2011-01-12 11:05:27 -0600
commit87c5c30fe8d2bbc31dabeb7383f5e5703a732bc5 (patch)
tree8fcdf4f8f87640237f2518b832ddbf28c3113c3e /lib/puppet/resource.rb
parent3f9f37984d1ac5f3ddcc83bf2b1facdb6df6dacd (diff)
downloadpuppet-87c5c30fe8d2bbc31dabeb7383f5e5703a732bc5.tar.gz
puppet-87c5c30fe8d2bbc31dabeb7383f5e5703a732bc5.tar.xz
puppet-87c5c30fe8d2bbc31dabeb7383f5e5703a732bc5.zip
(#5910) Improved logging when declared classes cannot be found:
Previously, when a class could not be found, it was displaying the same error message as when a resource type could not be found. This resulted in confusing error message: Invalid resource type class, when really it should display the name of the class that could not be found. My patch changes the error message to: Could not find declared class #{title}
Diffstat (limited to 'lib/puppet/resource.rb')
-rw-r--r--lib/puppet/resource.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb
index 4f0d50750..6821e0e06 100644
--- a/lib/puppet/resource.rb
+++ b/lib/puppet/resource.rb
@@ -201,8 +201,13 @@ class Puppet::Resource
tag(self.title) if valid_tag?(self.title)
@reference = Reference.new(@type,@title) # for serialization compatibility with 0.25.x
-
- raise ArgumentError, "Invalid resource type #{type}" if strict? and ! resource_type
+ if strict? and ! resource_type
+ if @type == 'Class'
+ raise ArgumentError, "Could not find declared class #{title}"
+ else
+ raise ArgumentError, "Invalid resource type #{type}"
+ end
+ end
end
def ref