Issue #8312 has been updated by Thomas Espenhain.

Status changed from Closed to Re-opened
Target version changed from 2.7.12 to 3.1.x

The problem isn't solved at all. If an additional repository (like puppet repo 
from build service) includes the name of the package and contains other 
packages, the pattern will match the first row and first column too (possible 
with the wrong package).

Here are some steps to reproduce (they depend on current update situation):
1. add the build service puppet repo to zypper with name repo-puppet
<pre>
zypper ar --refresh 
http://download.opensuse.org/repositories/systemsmanagement:/puppet/openSUSE_12.2/
 repo-puppet
</pre>
2. call zypper refresh and list-updates
<pre>
zypper ref && zypper list-updates
</pre>
3. check available updates from repo-puppet
<pre>
....
v | openSUSE-12.2-Update | ruby19                       | 1.9.3.p194-3.4.1      
   | 1.9.3.p385-3.18.1          | x86_64
v | repo-puppet          | rubygem-hiera                | 1.1.1-3.2             
   | 1.1.2-8.1                  | x86_64
v | repo-puppet          | rubygem-json                 | 1.7.5-23.3            
   | 1.7.7-27.1                 | x86_64
v | repo-puppet          | rubygem-ruby-shadow          | 2.1.4-1.1             
   | 2.1.4-5.1                  | x86_64
v | openSUSE-12.2-Update | sysconfig                    | 0.76.4-1.4.1          
   | 0.76.4-1.8.1               | x86_64
v | repo-puppet          | puppet                       | 3.0.2-1.1             
   | 3.1.0-1.1                  | x86_64
....
</pre>
4. log from puppet agent run
<pre>
...
Notice: /Stage[pre]/Pre-packages::Install/Package[puppet]/ensure: ensure 
changed '3.0.2-1.1' to '1.1.1-3.2'
...
</pre>
The update of package puppet will never occur.
----------------------------------------
Bug #8312: zypper ensure latest doesn't work on SLES11 SP1, OpenSUSE 11.4
https://projects.puppetlabs.com/issues/8312#change-86805

Author: Felix Frank
Status: Re-opened
Priority: Normal
Assignee: Ken Barber
Category: package
Target version: 3.1.x
Affected Puppet version: 2.6.8
Keywords: zypper, update, latest
Branch: https://github.com/kbarber/puppet/tree/ticket/2.7.x/8312-zypper_latest


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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to