The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Bug #14660

package provider gem does not use the specified source if ensure => latest

Added by Evgeny Dudin over 2 years ago. Updated almost 2 years ago.

Status:DuplicateStart date:05/22/2012
Priority:NormalDue 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

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This issue is currently not available for export. If you are experiencing the issue described below, please file a new ticket in JIRA. Once a new ticket has been created, please add a link to it that points back to this Redmine ticket.


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

Duplicates Puppet - Bug #15346: puppet allows the use of source as a parameter to the gem... Closed 07/03/2012

History

#1 Updated by James Turnbull over 2 years 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 over 2 years 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 over 2 years 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 over 2 years 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 Anonymous almost 2 years 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 almost 2 years ago

  • Status changed from In Topic Branch Pending Review to Duplicate

15346 dealt with similar behavior about the wrong gem repositories being used when installing, and the changes solved this problem as well. I am marking this ticket as a duplicate.

Also available in: Atom PDF