Issue #8312 has been updated by James Turnbull.

Assignee set to Felix Frank


----------------------------------------
Bug #8312: zypper ensure latest doesn't work on SLES11 SP1, OpenSUSE 11.4
https://projects.puppetlabs.com/issues/8312

Author: Felix Frank
Status: Requires CLA to be signed
Priority: Normal
Assignee: Felix Frank
Category: package
Target version: 
Affected Puppet version: 2.6.8
Keywords: zypper, update, latest
Branch: 


In the zypper provider, the output of `zypper list-updates` is parsed 
incorrectly.

The order of output fields is indeed not "name" | "new version"
but "name" | "old version" | "new version" instead.

The regexp in the provider therefore returns the old version instead of the new 
one. I suggest the following patch:
<pre>
--- puppet-2.6.8.orig/lib/puppet/provider/package/zypper.rb     2011-07-07 
18:44:15.000000000 +0200
+++ puppet-2.6.8/lib/puppet/provider/package/zypper.rb  2011-07-08 
13:10:24.000000000 +0200
@@ -36,7 +36,7 @@
     #zypper can only get a list of *all* available packages?
     output = zypper "list-updates"
 
-    if output =~ /#{Regexp.escape @resource[:name]}\s*\|\s*([^\s\|]+)/
+    if output =~ /#{Regexp.escape @resource[:name]}\s*\|.*?\|\s*([^\s\|]+)/
       return $1
     else
       # zypper didn't find updates, pretend the current
</pre>

How to reproduce: With an outdated package installed, run
<pre>
puppet --noop -e 'package { "<name>": ensure => latest, provider => zypper }'
</pre>
This will not generate a message about a pending update.


-- 
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://projects.puppetlabs.com/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