Bug #2662
Yum package arch and version ensuring failing
| Status: | Accepted | Start date: | 09/20/2009 | |
|---|---|---|---|---|
| Priority: | High | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | package | |||
| Target version: | - | |||
| Affected Puppet version: | 0.24.7 | Branch: | ||
| Keywords: | yum provider version arch ensure | |||
| Votes: | 6 |
Description
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.
Related issues
History
Updated by James Turnbull over 2 years ago
- Category set to package
- Status changed from Unreviewed to Needs More Information
- Assignee set to David Lutterkort
David – I remember something about this from the past – you?
Updated by Sven Mueller over 2 years ago
Problem here seems to be (in my humble opinion), that the package type and provider don’t support specifying an architecture for the package, so unless you want to ensure a specific version, everything works fine. But if you try to specify both architecture (in the package name) and version (via the ensure parameter), the package provider at least for yum works out a wrong package name+arch+version (instead of name+version+arch) for the installation (note: If you install the package manually, puppet detects the installed version fine and thus doesn’t try to reinstall the package).
I would propose adding an architecture parameter to the package type.
Updated by Sven Mueller over 2 years ago
Here is an anonymized log for this:
debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm -q boost-thread.x86_64 --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}
'
debug: //Node[some-node.example.com]/virtual_packages::some-class::build/Package[boost-thread.x86_64]: Changing ensure
debug: //Node[some-node.example.com]/virtual_packages::some-class::build/Package[boost-thread.x86_64]: 1 change(s)
debug: Package[boost-thread.x86_64](provider=yum): Ensuring => 1.39.0-6
debug: Puppet::Type::Package::ProviderYum: Executing '/usr/bin/yum -d 0 -e 0 -y install boost-thread.x86_64-1.39.0-6'
debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm -q boost-thread.x86_64 --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}
'
err: //Node[some-node.example.com]/virtual_packages::some-class::build/Package[boost-thread.x86_64]/ensure: change from absent to 1.39.0-6 failed: Could not update: Could not find package boost-thread.x86_64 at /etc/puppet/manifests/classes/virtual_packages.pp:1323
Updated by Patrick Otto over 2 years ago
Some lazy fix that works at least for me. I guess it will break on some Red Hat packages that do include a dot in their normal package name … (patch is against yum.rb, btw)
64,65c64,73 < # Add the package version < wanted += "-%s" % should --- > # Check if there's an architecture in the pkg name > # FIXME: Do a real check for known architectures instead of lazy matching > if wanted =~ /(.*)\.(.*)/ > pkg = $1 > arch = $2 > wanted = "%s-%s.%s" % pkg, should, arch > else > # Add the package version > wanted += "-%s" % should > end
Updated by David Ward over 2 years ago
Thanks Patrick.
That’s logical.
Is this logic in 0.25.0?
Updated by Patrick Otto over 2 years ago
David Ward wrote:
Is this logic in 0.25.0?
That’s puppet 0.24.8 in RHEL 5.3 (puppet-0.24.8-1.el5.1).
Updated by R.I. Pienaar over 2 years ago
Patrick Otto wrote:
Some lazy fix that works at least for me. I guess it will break on some Red Hat packages that do include a dot in their normal package name … (patch is against yum.rb, btw)
[…]
Does this mean no-one will be able to install any of the java or openjdk packages with puppet?
Updated by Patrick Otto over 2 years ago
R.I. Pienaar aka Volcane wrote:
Does this mean no-one will be able to install any of the java or openjdk packages with puppet?
Yes, my patch is a quick&dirty workaround for the setup over here. I do not recommend using this patch at all. It’s just a pointer.
Updated by David Lutterkort over 2 years ago
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:
# 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
Updated by James Turnbull over 2 years ago
- Target version set to 2.6.0
Updated by Sven Mueller over 2 years ago
I honestly think that simply listing the architectures in the RegExp is not the right way to go. Do you really want to keep updating that list of architectures whenever some yum-using Distribution decides to support some new architecture? Imagine someone porting RedHat-like stuff to the amount of architectures currently supported by Debian. I am quite convinced that providing an architecture parameter would be the right way. Especially when considering that at least Debian is also working on going multiarch (soon), so also the apt/dpkg providers (and rpm in any case, I would think) will need to know which architecture they are supposed to work on.
Updated by R.I. Pienaar over 2 years ago
I agree, arch => would be best.
If we say for yum we need name.arch and for debian probably we’d need some other kludgy naming convention on the package name to achieve the same and ditto for other operating systems.
Adding arch => solves it elegantly and the providers can do the right thing with the information for their OS, no need to try and come up with Regexes etc.
Updated by Thomas Bellman over 2 years ago
There’s one problem with moving the architecture from the package name to a new arch parameter: as Puppet is today, it makes it difficult to install multiple architectures of a package.
One might allow an array as arch parameter, but that still makes it difficult to manage the different packages from different parts of the manifests.
Updated by David Lutterkort over 2 years ago
Thomas Bellman wrote:
There’s one problem with moving the architecture from the package name to a new arch parameter: as Puppet is today, it makes it difficult to install multiple architectures of a package.
One might allow an array as arch parameter, but that still makes it difficult to manage the different packages from different parts of the manifests.
Thanks Thomas for reminding me of why I didn’t do that right off the bat – I couldn’t remember why I initially dismissed an arch parameter, but I believe that was it.
Updated by Sven Mueller over 2 years ago
David Lutterkort wrote:
Thomas Bellman wrote:
There’s one problem with moving the architecture from the package name to a new arch parameter: as Puppet is today, it makes it difficult to install multiple architectures of a package.
One might allow an array as arch parameter, but that still makes it difficult to manage the different packages from different parts of the manifests.
Thanks Thomas for reminding me of why I didn’t do that right off the bat – I couldn’t remember why I initially dismissed an arch parameter, but I believe that was it.
Problem here is: As puppet is today, it doesn’t make it hard to install multiple architectures of the same package. To the contrary: It makes it hard to install only a single architecture. Because with RedHat, if you don’t specify an architecture, it will install all available architectures of the package. And this behaviour along with the wish to control the version of the package that is being installed is what caused us stumbling over this bug.
And to be honest: If I want to install two different architectures of the same package (I don’t know any CPU architecture that would be able to natively support more than two package architectures), I still want them to be of the same version (or handled the same at that).
Though I understand the difficulty (having two package definitions that would have the same title if you minimize the amount of text in the manifest), I would still favour having an arch parameter. You could still do
package { “yum.i386”:
arch => "i386",
name => "yum",
ensure => latest,
}
to have different titles for different architectures if need be. But I would really prefer an arch parameter (which I could set a default for to $architecture, so that only the main system architecture is installed by default), which would accept an array to support multiple architectures.
Regards, Sven
Updated by R.I. Pienaar over 2 years ago
Problem here is: As puppet is today, it doesn’t make it hard to install multiple architectures of the same package. To the contrary: It makes it hard to install only a single architecture. Because with RedHat, if you don’t specify an architecture, it will install all available architectures of the package. And this behaviour along with the wish to control the version of the package that is being installed is what caused us stumbling over this bug.
Since RHEL 5.3 this is configurable in yum.conf, I set my machines to install just the best match package, so better multi arch support would be good.
Updated by Sven Mueller over 2 years ago
David Lutterkort wrote:
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:
[…]
Just for the record, to match all arches from arch.py, the list should probably be: /(.).(noarch|i[3-6]86|x86_64|ppc|ppc64|sparc.|s390.|alpha.|arm.|sh.|ia64)/ Apparently, there is also “athlon”, “geode”, “amd64”, “ia32e”, but I don’t think any of that was ever used as a package architecture.
Updated by Luke Kanies over 2 years ago
- Priority changed from Normal to High
Bumping because of the number of votes.
Updated by Jesse Wolfe almost 2 years ago
- Assignee changed from David Lutterkort to Markus Roberts
Updated by James Turnbull over 1 year ago
- Status changed from Needs More Information to Needs Decision
This seems like a design call needs to be made rather than more information needed.
Updated by Jesse Wolfe over 1 year ago
- Target version changed from 2.6.0 to 52
Updated by Todd Zullinger over 1 year ago
If an arch parameter is added, won’t that make a backwards-incompatible change? Currently, for folks that don’t need a specific version, package { ‘foo.i386’: } works. Would an arch parameter change that behavior? If not, then it may be needlessly confusing to require an arch parameter only when a version is used with the ensure parameter.
Updated by Sven Mueller over 1 year ago
Todd Zullinger wrote:
If an arch parameter is added, won’t that make a backwards-incompatible change? Currently, for folks that don’t need a specific version, package { ‘foo.i386’: } works. Would an arch parameter change that behavior? If not, then it may be needlessly confusing to require an arch parameter only when a version is used with the ensure parameter.
Well package.arch only works for the yum provider currently, if I’m not mistaken. And that is mostly accidental as far as I can tell. It should not be too much of a problem to extract the architecture from the title of the package resource if none is specified with an arch parameter (and I think a deprecation note of this notation would be right). Also, no arch parameter (and no .arch appendix to the title) could work just like today: Install the default architecture of the package manager. Also, an array of architectures could be specified if a package should be installed in more than one architecture.
Not that I have the ruby skills or time needed to implement this.
regards, Sven
Updated by James Turnbull 12 months ago
- Assignee changed from Markus Roberts to Nigel Kersten
Updated by James Turnbull 11 months ago
- Target version deleted (
52)
Updated by Nigel Kersten 9 months ago
I do think we should be heading towards an arch parameter, as well as a dedicated version parameter, and then we should stop overloading “ensure” with version information.
Does https://projects.puppetlabs.com/issues/7463 help anyone else in the short term? I believe that’s a sane middle ground to head for next.
Updated by Nigel Kersten 9 months ago
- Status changed from Needs Decision to Accepted
- Assignee deleted (
Nigel Kersten)
Updated by David Ward 9 months ago
Nigel Kersten wrote:
Does https://projects.puppetlabs.com/issues/7463 help anyone else in the short term? I believe that’s a sane middle ground to head for next.
I am not sure how it is any different in practice than the solution I offered in my initial bug report.
Updated by Nigel Kersten 9 months ago
David Ward wrote:
Nigel Kersten wrote:
Does https://projects.puppetlabs.com/issues/7463 help anyone else in the short term? I believe that’s a sane middle ground to head for next.
I am not sure how it is any different in practice than the solution I offered in my initial bug report.
It doesn’t, but the rest of the log of this ticket contains a bunch of other suggestions, some of which we’ll implement in the longer term.