From 86f8ff4fb5fa69dc59afeea4260d1a875f37d483 Mon Sep 17 00:00:00 2001 From: Andrew Shafer Date: Sat, 14 Jun 2008 09:38:36 -0600 Subject: Removed the unless condition in query, because the issue is a stale cached value and added comments that query will now always do so. The query method is only called in two places, from inside 'install' in yum.rb and from inside 'uninstall' in rpm. This behavior only happens when you have a lower version than the one you are 'ensuring'. Since the right package actually gets installed, the system is in sync next time, but the event of installation is lost and subscribing resources will never get it. --- lib/puppet/provider/package/rpm.rb | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'lib/puppet') diff --git a/lib/puppet/provider/package/rpm.rb b/lib/puppet/provider/package/rpm.rb index 35684e11d..a303da4e2 100755 --- a/lib/puppet/provider/package/rpm.rb +++ b/lib/puppet/provider/package/rpm.rb @@ -43,19 +43,20 @@ Puppet::Type.type(:package).provide :rpm, :source => :rpm, :parent => Puppet::Pr # a hash with entries :instance => fully versioned package name, and # :ensure => version-release def query - unless @property_hash[:epoch] - cmd = ["-q", @resource[:name], "--nosignature", "--nodigest", "--qf", "#{NEVRAFORMAT}\n"] - - begin - output = rpm(*cmd) - rescue Puppet::ExecutionFailure - return nil - end - - # FIXME: We could actually be getting back multiple packages - # for multilib - @property_hash.update(self.class.nevra_to_hash(output)) + #NOTE: Prior to a fix for issue 1243, this method potentially returned a cached value + #IF YOU CALL THIS METHOD, IT WILL CALL RPM + #Use get(:property) to check if cached values are available + cmd = ["-q", @resource[:name], "--nosignature", "--nodigest", "--qf", "#{NEVRAFORMAT}\n"] + + begin + output = rpm(*cmd) + rescue Puppet::ExecutionFailure + return nil end + + # FIXME: We could actually be getting back multiple packages + # for multilib + @property_hash.update(self.class.nevra_to_hash(output)) return @property_hash.dup end -- cgit