[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Daniel Pittman daniel at puppetlabs.com
Tue May 10 08:11:34 UTC 2011


The following commit has been merged in the experimental branch:
commit 292a8b92c74c8d9392348ef6e9718934471a0ac1
Author: Dan Bode <dan at puppetlabs.com>
Date:   Wed Apr 6 21:14:06 2011 -0400

    (#6985) Allows indirectors to accept a hash as an argument.
    
    Many indirectors need to take a hash as the last argument.
    This was not allowed b/c the last hash argument was assumed to
    be the options hash.
    I resolved this by assuming that the hash needed by an indirector
    would be the same as the options hash.
    
    Reviewed-By: Daniel Pittman <daniel at puppetlabs.com>

diff --git a/lib/puppet/faces/indirector.rb b/lib/puppet/faces/indirector.rb
index f722600..7e4e0f0 100644
--- a/lib/puppet/faces/indirector.rb
+++ b/lib/puppet/faces/indirector.rb
@@ -16,7 +16,7 @@ that we should describe in this file somehow."
   end
 
   def call_indirection_method(method, *args)
-    options = args.pop
+    options = args.last
     options.has_key?(:terminus) and set_terminus(options[:terminus])
 
     begin
diff --git a/spec/unit/faces/indirector_spec.rb b/spec/unit/faces/indirector_spec.rb
index 218694b..3ed64bc 100755
--- a/spec/unit/faces/indirector_spec.rb
+++ b/spec/unit/faces/indirector_spec.rb
@@ -34,10 +34,14 @@ describe Puppet::Faces::Indirector do
       Puppet::Faces::Indirector.should be_action(method)
     end
 
-    it "should call the indirection method when the '#{method}' action is invoked" do
-      subject.indirection.expects(method).with(:test, "myargs")
+    it "should call the indirection method with options when the '#{method}' action is invoked" do
+      subject.indirection.expects(method).with(:test, "myargs", {})
       subject.send(method, :test, "myargs")
     end
+    it "should forward passed options" do
+      subject.indirection.expects(method).with(:test, "action", {'one'=>'1'})
+      subject.send(method, :test, 'action', {'one'=>'1'})
+    end
   end
 
   it "should be able to override its indirection name" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list