The first argument was often nil, and the second was mandatory.

Signed-off-by: Paul Berry <[email protected]>
---
Local-branch: maint/next/remove_save_delegation
 lib/puppet/indirector.rb                  |    2 +-
 lib/puppet/indirector/indirection.rb      |    2 +-
 lib/puppet/node/facts.rb                  |    2 +-
 spec/integration/configurer_spec.rb       |    2 +-
 spec/unit/indirector/indirection_spec.rb  |    3 ---
 spec/unit/indirector_spec.rb              |    2 +-
 spec/unit/ssl/certificate_request_spec.rb |    4 ++--
 7 files changed, 7 insertions(+), 10 deletions(-)

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
-- 
1.7.2

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to