Puppet: System Administration Automated

Support

Ticket #1243 (new defect)

Opened 6 months ago

Last modified 6 months ago

puppet thinks yum fails to update a package when it succeeds

Reported by: robfay Assigned to: andrew
Priority: normal Milestone: 0.24.5
Component: package Version: 0.24.4
Severity: normal Keywords: yum
Cc: Triage Stage: Accepted
Attached Patches: None Complexity: Unknown

Description

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:

     package { "test":
         ensure => "1.21",
     }

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

Output from puppetd:

debug: Puppet::Type::Package::Provider Yum?: 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:

         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

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

Change History

05/22/08 08:46:11 changed by jamtur01

  • owner changed from community to luke.
  • stage changed from Unreviewed to Accepted.
  • milestone set to 0.24.5.

05/26/08 07:30:48 changed by andrew

  • owner changed from luke to andrew.