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

Paul Berry paul at puppetlabs.com
Tue May 10 08:02:50 UTC 2011


The following commit has been merged in the experimental branch:
commit 3063000155ddc475d1703d10cfc13770f687c3b2
Author: Paul Berry <paul at puppetlabs.com>
Date:   Mon Nov 29 14:52:26 2010 -0800

    Maint: Swap the order of arguments to Indirection#save
    
    The first argument was often nil, and the second was mandatory.

diff --git a/lib/puppet/indirector.rb b/lib/puppet/indirector.rb
index b0cabab..d3455c0 100644
--- a/lib/puppet/indirector.rb
+++ b/lib/puppet/indirector.rb
@@ -36,7 +36,7 @@ module Puppet::Indirector
 
   module InstanceMethods
     def save(key = nil)
-      self.class.indirection.save key, self
+      self.class.indirection.save self, key
     end
   end
 end
diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb
index 9095e48..eb0aa8a 100644
--- a/lib/puppet/indirector/indirection.rb
+++ b/lib/puppet/indirector/indirection.rb
@@ -247,7 +247,7 @@ class Puppet::Indirector::Indirection
 
   # Save the instance in the appropriate terminus.  This method is
   # normally an instance method on the indirected class.
-  def save(key, instance = nil)
+  def save(instance, key = nil)
     request = request(:save, key, instance)
     terminus = prepare(request)
 
diff --git a/lib/puppet/node/facts.rb b/lib/puppet/node/facts.rb
index 612dc32..fd99adc 100755
--- a/lib/puppet/node/facts.rb
+++ b/lib/puppet/node/facts.rb
@@ -15,7 +15,7 @@ class Puppet::Node::Facts
 
   # We want to expire any cached nodes if the facts are saved.
   module NodeExpirer
-    def save(key, instance)
+    def save(instance, key)
       Puppet::Node.indirection.expire(instance.name)
       super
     end
diff --git a/spec/integration/configurer_spec.rb b/spec/integration/configurer_spec.rb
index cb7d3d7..71b9652 100755
--- a/spec/integration/configurer_spec.rb
+++ b/spec/integration/configurer_spec.rb
@@ -34,7 +34,7 @@ describe Puppet::Configurer do
     it "should send a transaction report with valid data" do
 
       @configurer.stubs(:save_last_run_summary)
-      Puppet::Transaction::Report.indirection.expects(:save).with do |x, report|
+      Puppet::Transaction::Report.indirection.expects(:save).with do |report, x|
         report.time.class == Time and report.logs.length > 0
       end
 
diff --git a/spec/unit/indirector/indirection_spec.rb b/spec/unit/indirector/indirection_spec.rb
index b0e0f01..f49d94f 100755
--- a/spec/unit/indirector/indirection_spec.rb
+++ b/spec/unit/indirector/indirection_spec.rb
@@ -386,9 +386,6 @@ describe Puppet::Indirector::Indirection do
     describe "and storing a model instance" do
       before { @method = :save }
 
-      it_should_behave_like "Indirection Delegator"
-      it_should_behave_like "Delegation Authorizer"
-
       it "should return the result of the save" do
         @terminus.stubs(:save).returns "foo"
         @indirection.save(@instance).should == "foo"
diff --git a/spec/unit/indirector_spec.rb b/spec/unit/indirector_spec.rb
index 5aae5d0..119a52e 100755
--- a/spec/unit/indirector_spec.rb
+++ b/spec/unit/indirector_spec.rb
@@ -92,7 +92,7 @@ describe Puppet::Indirector, "when redirecting a model" do
     end
 
     it "should pass the instance and an optional key to the indirection's :save method" do
-      @indirection.expects(:save).with("key", @instance)
+      @indirection.expects(:save).with(@instance, "key")
       @instance.save "key"
     end
 
diff --git a/spec/unit/ssl/certificate_request_spec.rb b/spec/unit/ssl/certificate_request_spec.rb
index 437fc05..f37f9ba 100755
--- a/spec/unit/ssl/certificate_request_spec.rb
+++ b/spec/unit/ssl/certificate_request_spec.rb
@@ -200,7 +200,7 @@ describe Puppet::SSL::CertificateRequest do
         Puppet::SSL::CertificateAuthority.expects(:instance).returns ca
 
         csr = Puppet::SSL::CertificateRequest.new("me")
-        Puppet::SSL::CertificateRequest.indirection.expects(:save).with(nil, csr)
+        Puppet::SSL::CertificateRequest.indirection.expects(:save).with(csr, nil)
 
         csr.save
       end
@@ -211,7 +211,7 @@ describe Puppet::SSL::CertificateRequest do
         Puppet::SSL::CertificateAuthority.expects(:instance).returns nil
 
         csr = Puppet::SSL::CertificateRequest.new("me")
-        Puppet::SSL::CertificateRequest.indirection.expects(:save).with(nil, csr)
+        Puppet::SSL::CertificateRequest.indirection.expects(:save).with(csr, nil)
 
         csr.save
       end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list