[PUP-4131] Gem version specifiers are not idempotent Created: 2015/03/09  Updated: 2019/04/04  Resolved: 2015/06/01

Status: Closed
Project: Puppet
Component/s: Types and Providers
Affects Version/s: None
Fix Version/s: PUP 4.2.0

Type: Bug Priority: Normal
Reporter: Raphaël Pinson Assignee: Unassigned
Resolution: Fixed Votes: 4
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
is duplicated by PUP-4525 install_options confused on the way t... Closed
Story Points: 1
Sprint: Client 2015-06-10
Release Notes: Bug Fix
QA Contact: Eric Thompson



It would be useful to support Gem version requirements in package resources, such as:

    package { 'hiera-eyaml-gpg':
      ensure   => '>= 0.5.rc1',
      provider => gem,


    package { 'ruby_gpg':
      ensure   => '~> 0.3',
      provider => gem,


Previously, if the manifest specified a gem version as a constraint, e.g. ~> 0.3, as opposed to an explicit version 1.2.3 or latest, then the gem provider was not idempotent, and would attempt to reinstall the gem each time. With this fix, the gem provider is idempotent when using a gem version constraint.

Comment by Raphaël Pinson [ 2015/03/09 ]

The syntax used in the bug description already works, but is not idempotent.

https://github.com/puppetlabs/puppet/pull/3694 makes it idempotent.

Comment by Kurt Wall [ 2015/06/01 ]

Resolved based on QA Risk Assessment.

Comment by Josh Cooper [ 2015/06/09 ]

There was a problem with the previous fix when using rubygems < 2.0.0, e.g. when running puppet from source or gem install with a system ruby 1.9. An additional fix was merged in 34d39ec

Comment by Nicholas Fagerlund [ 2015/06/10 ]

This ticket's description needs love. Can someone update it with the previous behavior, how it differed from expected behavior, and how it was resolved?

Comment by Nicholas Fagerlund [ 2015/06/10 ]

Josh Cooper What does that mean, "is idempotent?" I think you might mean one of the following, but I can't tell which:

  • It will install the latest version that matches that specifier, and will be in sync if that latest-within-spec version is currently installed.
  • If any version that matches the specifier is installed, it will be in sync. Multiple machines may drift freely and have different versions installed, if they stay within the spec. If the version isn't in sync, Puppet will install ??????????????????? version of the gem.
Comment by Josh Cooper [ 2015/06/22 ]

Nicholas Fagerlund It's the latter, if the currently installed version satisfies the constraint, then the resource will be considered insync. So for example, if the constraint is > 1.0, and the system currently has installed 1.0 or later, then it will be considered insync. If the system has 0.9 installed, then it will not be insync, and puppet will install the latest version of the gem currently available that still satisfies the constraint.

Generated at Thu Jun 27 05:25:42 PDT 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.