puppetlabs-toy-chest / puppetlabs-puppetserver_gem

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

Source option does not work as documented for install #12

Closed alan-schwarzenberger closed 7 years ago

alan-schwarzenberger commented 7 years ago

There are a two problems with the source option used with install as documented here

  1. The documentation states that "If a URL is passed via source, then that URL is used as the remote gem repository". This is not quite true, as it adds a source to the end of the gem source list. The effect of this is that an install will always try rubygems.org first.
  2. You should be able to use the gem install option --clear-sources to workaround the above by adding that to the package install_options. However, this provider puts the install_options on the command line at line 74 but has previously put the source option onto the command line at line 68. The order of options on the gem install command line is important in this case as you need to clear the sources before adding the source you want. Illustrated here from the puppetserver gem command line:
    myhost:~ # puppetserver gem install jmx --version 1.0 --no-document --clear-sources --source https://my-internal-gem-repo/default.gems.global/
    Successfully installed jmx-1.0
    1 gem installed
    myhost:~ # puppetserver gem uninstall jmx
    Successfully uninstalled jmx-1.0
    myhost:~ # puppetserver gem install jmx --version 1.0 --no-document --source https://my-internal-gem-repo/default.gems.global/ --clear-sources 
    ERROR:  Could not find a valid gem 'jmx' (= 1.0), here is why:
          Unable to download data from https://rubygems.org/ - Errno::ECONNREFUSED: Connection refused - Connection refused (https://api.rubygems.org/specs.4.8.gz)

I'll prepare a PR that addresses these.