Issue #2662 has been updated by David  Lutterkort.

I think the suggested fix is spot on; clearly, we need to put the version in 
between the package name and the arch. We could intrdoduce a new arch parameter 
for that, but that seems more trouble than it's worth.

The one thing I would change about the patch is to restrict what suffixes we'd 
consider to be an arch. The canonical list is in arch.py in the yum source, but 
something like the following should work pretty well:

<pre>
# Check if there's an architecture in the pkg name
if wanted =~ /(.*)\.(noarch|i[3-6]86|x86_64|ppc|ppc64|sparc.*|s390.*)/
  pkg = $1
  arch = $2
  wanted = "%s-%s.%s" % pkg, should, arch
else
  # Add the package version
  wanted += "-%s" % should
end
</pre> 
----------------------------------------
Bug #2662: Yum package arch and version ensuring failing
http://projects.reductivelabs.com/issues/2662

Author: David Ward
Status: Needs more information
Priority: Normal
Assigned to: David  Lutterkort
Category: package
Target version: 
Affected version: 0.24.7
Keywords: yum provider version arch ensure
Branch: 


After lots of trial and error I found a bug in our current Puppet version

Having a package line like so:

 package { "firefox.x86_64": ensure => "3.0.12-1.el5.centos", require => 
Package["xulrunner.x86_64"] }

Would fail with debug output:
*_
debug: 
//Node[om012274.drd.int]/workstation/workstation_centos53/mozillasuite53/Package[firefox.x86_64]:
 Changing ensure
debug: 
//Node[om012274.drd.int]/workstation/workstation_centos53/mozillasuite53/Package[firefox.x86_64]:
 1 change(s)
debug: Package[firefox.x86_64](provider=yum): Ensuring => 3.0.12-1.el5.centos
debug: Puppet::Type::Package::ProviderYum: Executing '/usr/bin/yum -d 0 -e 0 -y 
install firefox.x86_64-3.0.12-1.el5.centos'
debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm -q 
firefox.x86_64 --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| 
%{VERSION} %{RELEASE}
%{ARCH}
'
err: 
//Node[om012274.drd.int]/workstation/workstation_centos53/mozillasuite53/Package[firefox.x86_64]/ensure:
 change from absent to 3.0.12-1.el5.centos failed: Could
 not update: Could not find package firefox.x86_64 at 
/etc/puppet/manifests/CentOS.pp:149_*


It didn't matter if I listed ver-release or just ver, same sort of error; it 
appends the version-[release] to the package name and arch. Which obviously 
fails as yum packages must be referred to like so:

          name
          name.arch
          name-ver
          name-ver-rel
          name-ver-rel.arch
          name-epoch:ver-rel.arch
          epoch:name-ver-rel.arch


So if I omitted the arch and changed the line to:

 package { "firefox": ensure => "3.0.12-1.el5.centos", require => 
Package["xulrunner.x86_64"] }

We would have more success with the 64bit version but it would try and bring 
the 32bit Firefox version too along with its dependencies. Not what I wanted.

*_debug: Package[firefox](provider=yum): Ensuring => 3.0.12-1.el5.centos.x86_64
debug: Puppet::Type::Package::ProviderYum: Executing '/usr/bin/yum -d 0 -e 0 -y 
install firefox-3.0.12-1.el5.centos.x86_64'
debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm -q firefox 
--nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} 
%{RELEASE} %{ARCH}
'
err: 
//Node[om012274.drd.int]/workstation/workstation_centos53/mozillasuite53/Package[firefox]/ensure:
 change from 3.0.12-1.el5.centos to 3.0.12-1.el5.centos.x86_64 failed: Could 
not update: Failed to update to version 3.0.12-1.el5.centos.x86_64, got version 
3.0.12-1.el5.centos instead at /etc/puppet/manifests/CentOS.pp:149_*


So chatting on IRC and more trial and error I found this is the only way to get 
it to work:


 package { "firefox-3.0.12-1.el5.centos.x86_64": ensure => "present", require 
=> Package["xulrunner.x86_64"] }

So this side-steps puppets version management though.

This may be fixed in a newer version. I haven't tried yet.






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