Bug #14660
package provider gem does not use the specified source if ensure => latest
| Status: | Duplicate | Start date: | 05/22/2012 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% | |
| Category: | package | |||
| Target version: | - | |||
| Affected Puppet version: | 2.7.14 | Branch: | https://github.com/puppetlabs/puppet/pull/809 | |
| Keywords: | gem,latest,source | |||
Description
I have a local gem repository where I put my gems. In the manifest I specify a package with ensure => latest and explicitly set the source
class trocla {
package { "moneta":
ensure => "latest",
provider => "gem",
source => "http://mylocalrepo/gem-repository/",
}
}
In spite of that, puppet does not use my repo to fetch the list of available gems (which is confusing – if I explicitly specify my custom repository, I expect this package to be pulled from this particular repository).
This can be seen in the output puppet with —debug option:
debug: Puppet::Type::Package::ProviderGem: Executing '/usr/bin/gem list --remote moneta$'
As you can see —source option is missing here
Related issues
History
#1
Updated by James Turnbull about 1 year ago
- Status changed from Unreviewed to Needs More Information
- Assignee set to Evgeny Dudin
I can’t replicate this. Can you show us the full output from just that resource?
My resource:
package { "moneta":
ensure => "latest",
provider => "gem",
source => "http://mylocalrepo/gem-repository/",
}
I see with in the gem installed
debug: Prefetching gem resources for package debug: Puppet::Type::Package::ProviderGem: Executing '/usr/bin/gem list --local' debug: Puppet::Type::Package::ProviderGem: Executing '/usr/bin/gem list --remote moneta$'
Without the gem installed:
debug: Puppet::Type::Package::ProviderGem: Executing '/usr/bin/gem list --local'
debug: Puppet::Type::Package::ProviderGem: Executing '/usr/bin/gem list --local moneta$'
debug: Package[moneta](provider=gem): Executing '/usr/bin/gem install --include-dependencies --source http://mylocalrepo/gem-repository/ moneta'
err: /Stage[main]//Package[moneta]/ensure: change from absent to latest failed: Could not update: Execution of '/usr/bin/gem install --include-dependencies --source http://mylocalrepo/gem-repository/ moneta' returned 1: ERROR: Could not find a valid gem 'moneta' (>= 0) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
SocketError: getaddrinfo: nodename nor servname provided, or not known (http://mylocalrepo/gem-repository/latest_specs.4.8.gz)
INFO: `gem install -y` is now default and will be removed
INFO: use --ignore-dependencies to install only the gems you list
at /tmp/gem.pp:5
It logically fails because the local gem source doesn’t exist but the correct command is run.
#2
Updated by Evgeny Dudin about 1 year ago
- Assignee changed from Evgeny Dudin to James Turnbull
Many thanks for the quick reply.
Ok, so here is the story. I maintain this gems in my custom repository, and I want puppet to update the gem on the box, once I’ve pushed a new version of gem to the repo.
The box has 0.6.1 version of gem installed currently. I’ve pushed 0.6.2 version to the repo. The public repository contains “official” 0.6.0 version.
When I declare package with my custom repo as a source and say “ensure => latest”, I expect puppet to run:
/usr/bin/gem list --remote --source http://mylocalrepo/gem-repository/ moneta$ and get my new 0.6.2 custom version as latest, but instead of that I can see /usr/bin/gem list --remote moneta$ which pulls latest version from the public repo (0.6.0) and I am getting downgrade 0.6.1 –> 0.6.0
Here is the part of the output I am getting
debug: Puppet::Type::Package::ProviderGem: Executing '/usr/bin/gem list --remote moneta$' debug: /Stage[main]/Trocla/Package[moneta]/ensure: moneta ["0.6.1"] is installed, latest is "0.6.0" notice: /Stage[main]/Trocla/Package[moneta]/ensure: current_value 0.6.1, should be 0.6.0 (noop)
but I expect
current_value 0.6.1, should be 0.6.2 (noop)
#3
Updated by James Turnbull about 1 year ago
Ah ha! The provider isn’t checking the local source when checking latest. Hmmm let me look at it.
#4
Updated by James Turnbull about 1 year ago
- Status changed from Needs More Information to In Topic Branch Pending Review
- Assignee deleted (
James Turnbull) - Target version set to 2.7.x
- Branch set to https://github.com/puppetlabs/puppet/pull/809
#5
Updated by Andrew Parker 6 months ago
- Target version deleted (
2.7.x)
As the 2.7.x line is winding down, I am removing the target at 2.7.x from tickets in the system. The 2.7 line should only receive fixes for major problems (crashes, for instance) or security problems.
#6
Updated by Adrien Thebo 4 months ago
- Status changed from In Topic Branch Pending Review to Duplicate