[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

Jesse Wolfe jes5199 at gmail.com
Wed Jul 14 10:35:25 UTC 2010


The following commit has been merged in the upstream branch:
commit e5478d4ff0510e637ecec69f8b2fc7ef844ba5c0
Author: Jesse Wolfe <jes5199 at gmail.com>
Date:   Fri Jun 25 14:04:13 2010 -0700

    Simplify the newattr method by removing a level violation
    
    and update the specs that were testing it.

diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index f6b0282..2aeec82 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -496,12 +496,6 @@ class Type
             return @parameters[name]
         end
 
-        if provider and ! provider.class.supports_parameter?(klass)
-            missing = klass.required_features.find_all { |f| ! provider.class.feature?(f) }
-            info "Provider %s does not support features %s; not managing attribute %s" % [provider.class.name, missing.join(", "), name]
-            return nil
-        end
-
         begin
             # make sure the parameter doesn't have any errors
             return @parameters[name] = klass.new(:resource => self)
diff --git a/spec/unit/type/service_spec.rb b/spec/unit/type/service_spec.rb
index f09ed98..48d87ba 100755
--- a/spec/unit/type/service_spec.rb
+++ b/spec/unit/type/service_spec.rb
@@ -76,18 +76,10 @@ describe Puppet::Type.type(:service), "when validating attribute values" do
 
     it "should allow setting the :enable parameter if the provider has the :enableable feature" do
         Puppet::Type.type(:service).defaultprovider.stubs(:supports_parameter?).returns(true)
-        Puppet::Type.type(:service).defaultprovider.expects(:supports_parameter?).with(Puppet::Type.type(:service).attrclass(:enable)).returns(true)
         svc = Puppet::Type.type(:service).new(:name => "yay", :enable => true)
         svc.should(:enable).should == :true
     end
 
-    it "should not allow setting the :enable parameter if the provider is missing the :enableable feature" do
-        Puppet::Type.type(:service).defaultprovider.stubs(:supports_parameter?).returns(true)
-        Puppet::Type.type(:service).defaultprovider.expects(:supports_parameter?).with(Puppet::Type.type(:service).attrclass(:enable)).returns(false)
-        svc = Puppet::Type.type(:service).new(:name => "yay", :enable => true)
-        svc.should(:enable).should be_nil
-    end
-
     it "should split paths on ':'" do
         FileTest.stubs(:exist?).returns(true)
         FileTest.stubs(:directory?).returns(true)
diff --git a/test/ral/manager/attributes.rb b/test/ral/manager/attributes.rb
index cf8f2f9..5ddd27f 100755
--- a/test/ral/manager/attributes.rb
+++ b/test/ral/manager/attributes.rb
@@ -115,12 +115,16 @@ class TestTypeAttributes < Test::Unit::TestCase
 
         # Now set each of them
         attr_check(type) do |inst, klass|
-            inst.newattr(klass.name, :value => "value")
+            property = inst.newattr(klass.name)
+            property.value = "value"
+            property
         end
 
         # Now try it passing the class in
         attr_check(type) do |inst, klass|
-            inst.newattr(klass, :value => "value")
+            property = inst.newattr(klass)
+            property.value = "value"
+            property
         end
 
         # Lastly, make sure we can create and then set, separately
@@ -131,10 +135,9 @@ class TestTypeAttributes < Test::Unit::TestCase
             end
 
             # Make sure we can't create a new param object
-            assert_raise(Puppet::Error,
-                "Did not throw an error when replacing attr") do
-                    inst.newattr(klass.name, :value => "yay")
-            end
+            new_attr = inst.newattr(klass.name)
+            assert_equal(new_attr, obj, "newattr should return the same object if called a second time")
+
             obj
         end
     end
@@ -221,10 +224,7 @@ class TestTypeAttributes < Test::Unit::TestCase
             end
             yes.each { |a| assert(resource.should(a), "Did not get value for %s in %s" % [a, prov.name]) }
             no.each do |a|
-                assert_nil(resource.should(a), "Got value for unsupported %s in %s" % [a, prov.name])
-                if Puppet::Util::Log.sendlevel?(:info)
-                    assert(@logs.find { |l| l.message =~ /not managing attribute #{a}/ and l.level == :info }, "No warning about failed %s" % a)
-                end
+                # These may or may not get passed to the provider. We shouldn't care.
             end
 
             @logs.clear
@@ -288,6 +288,7 @@ class TestTypeAttributes < Test::Unit::TestCase
         cleanup { Puppet::Type.rmtype(:unsupported) }
 
         obj = type.new(:name => "test", :check => :yep)
+        obj.stubs(:newattr).returns(stub_everything("newattr"))
         obj.expects(:newattr).with(:nope).never
         obj[:check] = :all
     end
diff --git a/test/ral/manager/type.rb b/test/ral/manager/type.rb
index ff3d0b0..f1dc437 100755
--- a/test/ral/manager/type.rb
+++ b/test/ral/manager/type.rb
@@ -65,7 +65,7 @@ class TestType < Test::Unit::TestCase
             :ensure => "file"
         )
 
-        assert_raise(Puppet::Error, "Did not fail to alias when no catalog was available") {
+        assert_raise(Puppet::DevError, "It should fail to alias when no catalog was available") {
             resource[:alias] = "funtest"
         }
     end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list