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

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:31:05 UTC 2010


The following commit has been merged in the upstream branch:
commit 2777e1f052a51f0f52086cdfbea790902b0cecdc
Author: Luke Kanies <luke at reductivelabs.com>
Date:   Tue Mar 23 10:00:11 2010 -0700

    Fixing feature validation when passed one item
    
    When I changed how the validation errors worked
    I accidentally caused the feature list to need
    to be an array rather than supporting either.
    
    Signed-off-by: Luke Kanies <luke at reductivelabs.com>

diff --git a/lib/puppet/property.rb b/lib/puppet/property.rb
index b96f6d1..4b58abd 100644
--- a/lib/puppet/property.rb
+++ b/lib/puppet/property.rb
@@ -333,6 +333,7 @@ class Puppet::Property < Puppet::Parameter
     # Make sure that we've got all of the required features for a given value.
     def validate_features_per_value(value)
         if features = self.class.value_option(self.class.value_name(value), :required_features)
+            features = Array(features)
             needed_features = features.collect { |f| f.to_s }.join(", ")
             raise ArgumentError, "Provider must have features '#{needed_features}' to set '#{self.class.name}' to '#{value}'" unless provider.satisfies?(features)
         end
diff --git a/spec/unit/property.rb b/spec/unit/property.rb
index af3dbc4..64bad19 100755
--- a/spec/unit/property.rb
+++ b/spec/unit/property.rb
@@ -325,6 +325,14 @@ describe Puppet::Property do
 
             @property.should = "foo"
         end
+
+        it "should support specifying an individual required feature" do
+            value = @class.newvalue(/./, :required_features => :a)
+
+            @provider.expects(:satisfies?).returns true
+
+            @property.should = "foo"
+        end
     end
 
     describe "when munging values" do
diff --git a/spec/unit/type/package.rb b/spec/unit/type/package.rb
index b76374e..11bd597 100755
--- a/spec/unit/type/package.rb
+++ b/spec/unit/type/package.rb
@@ -61,32 +61,32 @@ describe Puppet::Type.type(:package), "when validating attribute values" do
     end
 
     it "should support :purged as a value to :ensure if the provider has the :purgeable feature" do
-        @provider.expects(:satisfies?).with(:purgeable).returns(true)
+        @provider.expects(:satisfies?).with([:purgeable]).returns(true)
         Puppet::Type.type(:package).new(:name => "yay", :ensure => :purged)
     end
 
     it "should not support :purged as a value to :ensure if the provider does not have the :purgeable feature" do
-        @provider.expects(:satisfies?).with(:purgeable).returns(false)
+        @provider.expects(:satisfies?).with([:purgeable]).returns(false)
         proc { Puppet::Type.type(:package).new(:name => "yay", :ensure => :purged) }.should raise_error(Puppet::Error)
     end
 
     it "should support :latest as a value to :ensure if the provider has the :upgradeable feature" do
-        @provider.expects(:satisfies?).with(:upgradeable).returns(true)
+        @provider.expects(:satisfies?).with([:upgradeable]).returns(true)
         Puppet::Type.type(:package).new(:name => "yay", :ensure => :latest)
     end
 
     it "should not support :latest as a value to :ensure if the provider does not have the :upgradeable feature" do
-        @provider.expects(:satisfies?).with(:upgradeable).returns(false)
+        @provider.expects(:satisfies?).with([:upgradeable]).returns(false)
         proc { Puppet::Type.type(:package).new(:name => "yay", :ensure => :latest) }.should raise_error(Puppet::Error)
     end
 
     it "should support version numbers as a value to :ensure if the provider has the :versionable feature" do
-        @provider.expects(:satisfies?).with(:versionable).returns(true)
+        @provider.expects(:satisfies?).with([:versionable]).returns(true)
         Puppet::Type.type(:package).new(:name => "yay", :ensure => "1.0")
     end
 
     it "should not support version numbers as a value to :ensure if the provider does not have the :versionable feature" do
-        @provider.expects(:satisfies?).with(:versionable).returns(false)
+        @provider.expects(:satisfies?).with([:versionable]).returns(false)
         proc { Puppet::Type.type(:package).new(:name => "yay", :ensure => "1.0") }.should raise_error(Puppet::Error)
     end
 
diff --git a/spec/unit/type/user.rb b/spec/unit/type/user.rb
index deabd47..3d4d49d 100755
--- a/spec/unit/type/user.rb
+++ b/spec/unit/type/user.rb
@@ -254,7 +254,7 @@ describe user do
     describe "when manages_solaris_rbac is enabled" do
         before do
             @provider.stubs(:satisfies?).returns(false)
-            @provider.expects(:satisfies?).with(:manages_solaris_rbac).returns(true)
+            @provider.expects(:satisfies?).with([:manages_solaris_rbac]).returns(true)
         end
 
         it "should support a :role value for ensure" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list