puppetlabs-toy-chest / puppetlabs-puppetserver_gem

This module provides management of Ruby gems for Puppet Server.
3 stars 24 forks source link

When using versioning, this doesn't uninstall other versions of the same gem #17

Closed kpaulisse closed 4 years ago

kpaulisse commented 7 years ago

Sample input:

package { 'my-gem':
  ensure   => '0.1.2',
  provider => puppetserver_gem,
}

If I had previously installed a different version of the gem, that different version also remains after I do the above. I couldn't figure out the pattern of which version puppetserver will use, because it didn't always seem to be the latest, and certainly wasn't always the version I wanted.

Therefore, I think this provider should uninstall other versions of the same gem that are present when a specific version has been requested.

tkishel commented 5 years ago

Ensuring a specific version to be present is logically different than ensuring earlier versions be absent, and even the gem update command documents that it doesn't cleanup old versions:

https://guides.rubygems.org/command-reference/#gem-update

tkishel commented 4 years ago

For example:

[root@pe-201950-master ~]# /opt/puppetlabs/puppet/bin/gem list

*** LOCAL GEMS ***

bigdecimal (default: 1.3.4)
cmath (default: 1.0.0)
colored2 (3.1.2)
concurrent-ruby (1.1.5)
cri (2.15.10)
csv (default: 1.0.0)
date (default: 1.0.0)
deep_merge (1.0.1)
did_you_mean (1.2.0)
etc (default: 1.0.0)
ethon (0.9.0)
facter (3.14.9, 2.5.7)
facter-ng (4.0.9.pre)
faraday (0.14.0)
faraday_middleware (0.12.2)
faraday_middleware-multi_json (0.0.6)
fast_gettext (1.1.2)
fcntl (default: 1.0.0)
ffi (1.11.1, 1.9.25)

Closing, as this is the expected behavior of gem install.