Please review pull request #728: Fix incorrect argument handling for expire in NodeExpirer opened by (pcarlisle)

Description:

Since it takes an optional key it needs to use that key if it exists. This
also resolves an error undefined method 'name' for #<Hash... that could
occur when posting facts over REST if the yaml didn't have a proper name
variable. This will still fail, but at a point that gives a much better error
message.

  • Opened: Mon Apr 30 19:09:00 UTC 2012
  • Based on: puppetlabs:2.7.x (7e92a7c416f331d15424e22979471928f7603938)
  • Requested merge: pcarlisle:maint/2.7.x/post-facts (1c9bec019e08ce7f53d9fb8c9e7c7b23cc7c8bca)

Diff follows:

diff --git a/lib/puppet/node/facts.rb b/lib/puppet/node/facts.rb
index 577b62b..1d7e221 100755
--- a/lib/puppet/node/facts.rb
+++ b/lib/puppet/node/facts.rb
@@ -16,7 +16,7 @@ class Puppet::Node::Facts
   # We want to expire any cached nodes if the facts are saved.
   module NodeExpirer
     def save(instance, key = nil)
-      Puppet::Node.indirection.expire(instance.name)
+      Puppet::Node.indirection.expire(key, instance)
       super
     end
   end
diff --git a/spec/integration/node/facts_spec.rb b/spec/integration/node/facts_spec.rb
index 78bdabc..689f6bf 100755
--- a/spec/integration/node/facts_spec.rb
+++ b/spec/integration/node/facts_spec.rb
@@ -10,9 +10,10 @@
       terminus = Puppet::Node::Facts.indirection.terminus(:yaml)
       terminus.stubs :save
 
-      Puppet::Node.indirection.expects(:expire).with("me")
-
       facts = Puppet::Node::Facts.new("me")
+
+      Puppet::Node.indirection.expects(:expire).with(nil, facts)
+
       Puppet::Node::Facts.indirection.save(facts)
     end
 

    

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