So I've got Puppet Enterprise 2.7 on a "master" node, puppetentmaster. While working to craft new recipes for installing Ruby 2.0 on a "client" node, I noticed if I forced the client to begin using gem 2.0 I would run into errors like:

err: /Stage[main]/_ruby::Mysql_gem/Package[mysql]/ensure: change from absent to 2.8.1 failed: Could not update: Execution of '/usr/bin/gem install -v 2.8.1 --include-dependencies --no-rdoc --no-ri mysql' returned 1: ERROR:  While executing gem ... (OptionParser::InvalidOption)
    invalid option: --include-dependencies
 at /etc/puppetlabs/puppet/environments/ci/modules/_ruby/manifests/mysql_gem.pp:29

I traced the --include-dependencies to https://github.com/puppetlabs/puppet/commit/2284e837939628f81149e62fdc0f314ff077a776, it has since been removed, so I removed it from my Puppet provider code on the master in /opt/puppet/lib/site_ruby/1.8/puppet/provider/package/gem.rb:

  def install(useversion = true)
    command = [command(:gemcmd), "install"]
    command << "-v" << resource[:ensure] if (! resource[:ensure].is_a? Symbol) and useversion
    # JOE HAS BEEN HERE - see http://projects.puppetlabs.com/issues/19741,
    # https://github.com/puppetlabs/puppet/commit/2284e837939628f81149e62fdc0f314ff077a776
    # Always include dependencies
    # command << "--include-dependencies"

Unfortunately the code for gem.rb is inexplicably cached somewhere - I've restarted every service I can think to restart to no avail, I still get the --include-dependencies option included.

How does one force that provider code to get reloaded on the master to take out the --include-dependencies when using the gem provider?

  • 1
    Have you tried changing this on the client instead of the master? – sciurus Feb 1 '14 at 23:33
  • That is the answer. What I ended up doing is created a patch file in my Puppet code to patch the client gem.rb prior to using update-alternatives. – Joe Feb 2 '14 at 3:35

You need to change the source on the puppet client, not the master.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.