diff options
author | Dan Bode <bodepd@gmail.com> | 2011-01-11 20:00:32 -0600 |
---|---|---|
committer | Dan Bode <bodepd@gmail.com> | 2011-01-12 11:05:27 -0600 |
commit | 87c5c30fe8d2bbc31dabeb7383f5e5703a732bc5 (patch) | |
tree | 8fcdf4f8f87640237f2518b832ddbf28c3113c3e /lib/puppet/resource.rb | |
parent | 3f9f37984d1ac5f3ddcc83bf2b1facdb6df6dacd (diff) | |
download | puppet-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.rb | 9 |
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 |