Issue #1243 has been updated by andrew.

Status changed from Accepted to Ready for Checkin
Assigned to changed from andrew to jamtur01
% Done changed from 0 to 100
Complexity changed from Unknown to Easy

I tested this locally (EC2 actually), I could reproduce the problem and saw the 
fix work, but I could find no unit tests for these providers.

The specs would be a small project by themselves.  I might get inspired and 
spec them out, but not tonight and probably not before velocity.

But it will work, it is a very simple fix, removing an 'optimization'

uh . . . trust me

:/

Put the fix on git://github.com/littleidea/puppet.git on branch 
'ticket/0.24.x/1243'
----------------------------------------
Bug #1243: puppet thinks yum fails to update a package when it succeeds
http://reductivelabs.com/redmine/issues/show/1243

Author: robfay
Status: Ready for Checkin
Priority: Normal
Assigned to: jamtur01
Category: package
Target version: 0.24.5
Keywords: 
Complexity: Easy
Patch: None
Affected version: 


When trying to use puppet to update a package to a particular version and exec
a command when that update is applied, puppet calls yum which successfully 
updates the package, but puppet then thinks the update has failed and hence 
doesn't trigger the exec. Next cycle the package is already the correct 
version, so the update isn't applied, so the exec is never called.

manifest snippet:
<pre>
     package { "test":
         ensure => "1.21",
     }

     exec { "testcmd":
         command => "/foo/bar",
         refreshonly => true,
         subscribe => package[[test]]
     }
</pre>
Output from puppetd:

debug: Puppet::Type::Package::ProviderYum: Executing '/usr/bin/yum -d 0 -e 0 -y 
install test-1.21'
/usr/lib/site_ruby/1.8/puppet/parameter.rb:279:in @fail'
/usr/lib/site_ruby/1.8/puppet/type/package.rb:88
/usr/lib/site_ruby/1.8/puppet/type/package.rb:84:in @instance_eval'
/usr/lib/site_ruby/1.8/puppet/property.rb:181:in @instance_eval'
/usr/lib/site_ruby/1.8/puppet/property.rb:181:in @call_valuemethod'
/usr/lib/site_ruby/1.8/puppet/property.rb:350:in @set'
/usr/lib/site_ruby/1.8/puppet/property.rb:422:in @sync'
/usr/lib/site_ruby/1.8/puppet/propertychange.rb:81:in @go'
/usr/lib/site_ruby/1.8/puppet/propertychange.rb:109:in @forward'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:117:in @apply_changes'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:109:in @collect'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:109:in @apply_changes'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:81:in @apply'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:238:in @eval_resource'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:237:in @thinmark'
/usr/lib/site_ruby/1.8/puppet/util.rb:444:in @measure'
/usr/lib/ruby/1.8/benchmark.rb:342:in @realtime'
/usr/lib/site_ruby/1.8/puppet/util.rb:444:in @thinmark'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:239:in @eval_resource'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:309:in @evaluate'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:308:in @thinmark'
/usr/lib/site_ruby/1.8/puppet/util.rb:444:in @measure'
/usr/lib/ruby/1.8/benchmark.rb:342:in @realtime'
/usr/lib/site_ruby/1.8/puppet/util.rb:444:in @thinmark'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:310:in @evaluate'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:302:in @collect'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:302:in @evaluate'
/usr/lib/site_ruby/1.8/puppet/node/catalog.rb:118:in @apply'
/usr/lib/site_ruby/1.8/puppet/network/client/master.rb:264:in @run'
/usr/lib/site_ruby/1.8/puppet/network/client/master.rb:263:in @benchmark'
/usr/lib/site_ruby/1.8/puppet/util.rb:211:in @measure'
/usr/lib/ruby/1.8/benchmark.rb:342:in @realtime'
/usr/lib/site_ruby/1.8/puppet/util.rb:211:in @benchmark'
/usr/lib/site_ruby/1.8/puppet/network/client/master.rb:263:in @run'
/usr/lib/site_ruby/1.8/puppet/network/client/master.rb:245:in @synchronize'
/usr/lib/site_ruby/1.8/puppet/network/client/master.rb:245:in @run'
/usr/bin/puppetd:439
err: /:main/Node[testnode]/test/Package[test]/ensure: change from 1.20 to 1.21 
failed:
Could not update: Failed to update to version1.21, got version 1.20 instead at
/etc/puppet/modules/test/manifests/init.pp:28
notice: /:main/Node[testnode]/test/Exec[testcmd]: Dependency package[test] has 
1 failures
warning: /:main/Node[testnode]/test/Exec[testcmd]: Skipping because of failed 
dependencies

The package is successfully updated to 1.21. The yum command -
'/usr/bin/yum -d 0 -e 0 -y install test-1.21' - works fine with returncode
0 and no errors when run independently. 

O/S is Scientific Linux 4 (RHEL4), yum version is 2.4.2.

----

Response from Luke on puppet-users:

"This is a result of the following code:
<pre>
         is = self.query
         unless is
             raise Puppet::Error, "Could not find package %s" % self.name
         end

         # FIXME: Should we raise an exception even if should == :latest
         # and yum updated us to a version other than @param_hash[:ensure] ?
         if should && should != is[:ensure]
             raise Puppet::Error, "Failed to update to version  
#{should}, got version #{is[:ensure]} instead"
         end
</pre>
I *think* that code is in place because yum always exits 0, so we need  
to do extra checking to see if it actually installed or not.

It looks like the query isn't actually running again, which is your  
problem.

Please file this as a bug; it should be relatively straightforward to  
fix."



----------------------------------------
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to