[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 2.6.5rc1-120-g2247c80

Paul Berry paul at puppetlabs.com
Mon Feb 7 06:42:47 UTC 2011


The following commit has been merged in the upstream branch:
commit ed1359902d14a0ca89dac5debee756209b0bd433
Merge: 526335cff0f47c1efc25ffda535e2ead10f10fac 87c5c30fe8d2bbc31dabeb7383f5e5703a732bc5
Author: Paul Berry <paul at puppetlabs.com>
Date:   Tue Feb 1 17:23:23 2011 -0800

    Merge remote branch 'bodepd/feature/2.6.4/5910' into 2.6.next
    
    * bodepd/feature/2.6.4/5910:
      (#5910) Improved logging when declared classes cannot be found:

diff --combined lib/puppet/resource.rb
index b0a3ece,6821e0e..e832804
--- a/lib/puppet/resource.rb
+++ b/lib/puppet/resource.rb
@@@ -46,10 -46,6 +46,10 @@@ class Puppet::Resourc
      resource
    end
  
 +  def inspect
 +    "#{@type}[#{@title}]#{to_hash.inspect}"
 +  end
 +
    def to_pson_data_hash
      data = ([:type, :title, :tags] + ATTRIBUTES).inject({}) do |hash, param|
        next hash unless value = self.send(param)
@@@ -205,8 -201,13 +205,13 @@@
      tag(self.title) if valid_tag?(self.title)
  
      @reference = Reference.new(@type, at 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
diff --combined spec/unit/resource_spec.rb
index 877b6b6,11ff904..ff31b24
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@@ -98,6 -98,14 +98,14 @@@ describe Puppet::Resource d
      lambda { Puppet::Resource.new("foo") }.should raise_error(ArgumentError)
    end
  
+   it 'should fail if strict is set and type does not exist' do
+     lambda { Puppet::Resource.new('foo', 'title', {:strict=>true}) }.should raise_error(ArgumentError, 'Invalid resource type foo') 
+   end
+ 
+   it 'should fail if strict is set and class does not exist' do
+     lambda { Puppet::Resource.new('Class', 'foo', {:strict=>true}) }.should raise_error(ArgumentError, 'Could not find declared class foo') 
+   end
+ 
    it "should fail if the title is a hash and the type is not a valid resource reference string" do
      lambda { Puppet::Resource.new({:type => "foo", :title => "bar"}) }.should raise_error(ArgumentError,
        'Puppet::Resource.new does not take a hash as the first argument. Did you mean ("foo", "bar") ?'
@@@ -585,7 -593,9 +593,7 @@@
      end
    end
  
 -  describe "when converting to pson" do
 -    confine "Missing 'pson' library" => Puppet.features.pson?
 -
 +  describe "when converting to pson", :if => Puppet.features.pson? do
      def pson_output_should
        @resource.class.expects(:pson_create).with { |hash| yield hash }
      end
@@@ -664,7 -674,9 +672,7 @@@
      end
    end
  
 -  describe "when converting from pson" do
 -    confine "Missing 'pson' library" => Puppet.features.pson?
 -
 +  describe "when converting from pson", :if => Puppet.features.pson? do
      def pson_result_should
        Puppet::Resource.expects(:new).with { |hash| yield hash }
      end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list