[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:33 UTC 2010


The following commit has been merged in the upstream branch:
commit 847233ffd66005124f23d028601dfe565c2bf026
Author: Luke Kanies <luke at reductivelabs.com>
Date:   Mon Jan 4 16:32:33 2010 -0800

    Adding []/[]= support to Parser::Resource
    
    Signed-off-by: Luke Kanies <luke at reductivelabs.com>

diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb
index 651ed42..63d028c 100644
--- a/lib/puppet/parser/resource.rb
+++ b/lib/puppet/parser/resource.rb
@@ -56,6 +56,10 @@ class Puppet::Parser::Resource
         end
     end
 
+    def []=(param, value)
+        set_parameter(param, value)
+    end
+
     def builtin=(bool)
         @ref.builtin = bool
     end
diff --git a/spec/unit/parser/resource.rb b/spec/unit/parser/resource.rb
index d41d4f4..2b57f78 100755
--- a/spec/unit/parser/resource.rb
+++ b/spec/unit/parser/resource.rb
@@ -75,6 +75,16 @@ describe Puppet::Parser::Resource do
         @resource.to_ral.should == "yay"
     end
 
+    it "should be able to use the indexing operator to access parameters" do
+        resource = Puppet::Parser::Resource.new(:type => "resource", :title => "testing", :source => "source", :scope => "scope")
+        resource["foo"] = "bar"
+        resource["foo"].should == "bar"
+    end
+
+    it "should return the title when asked for a parameter named 'title'" do
+        Puppet::Parser::Resource.new(:type => "resource", :title => "testing", :source => "source", :scope => "scope")[:title].should == "testing"
+    end
+
     describe "when initializing" do
         before do
             @arguments = {:type => "resource", :title => "testing", :scope => stub('scope', :source => mock('source'))}

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list