puppet-r10k icon indicating copy to clipboard operation
puppet-r10k copied to clipboard

Upgrade support for Puppet 5.0

Open WetHippie opened this issue 8 years ago • 7 comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.0.x
  • Ruby: 2.4.0 (as required by puppet 5)
  • Distribution: All
  • Module version: 6.10.x

How to reproduce (e.g Puppet code you use)

Upgrade of puppet 5.0 by use of puppetlabs/puppet_agent. Auto install of the latest version (after manually setting the new ::source)

What are you seeing

With the new version of puppet and ruby, the gem isn't installed to run r10k with on the command line (and similar when auto managed using this module)

/opt/puppetlabs/puppet/lib/ruby/2.4.0/rubygems/dependency.rb:308:in `to_specs': Could not find 'r10k' (>= 0) among 27 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/root/.gem/ruby/2.4.0:/opt/puppetlabs/puppet/lib/ruby/gems/2.4.0', execute `gem env` for more information
	from /opt/puppetlabs/puppet/lib/ruby/2.4.0/rubygems/dependency.rb:320:in `to_spec'
	from /opt/puppetlabs/puppet/lib/ruby/2.4.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
	from /bin/r10k:22:in `<main>'

What behaviour did you expect instead

Difficult to say other than "should make sure the new gem is auto installed with ruby 2.4. However, this is a chicken an egg situation in that ruby won't be installed until puppet is, and then once it is, puppet can't run in order to get r10k to update itself.

Output log

See above

Any additional information you'd like to impart

None.

WetHippie avatar Jul 03 '17 00:07 WetHippie

@WetHippie I can't upgrade to Puppet 5 w/ r10k myself (I'm a PE user) but can you share the manifest you're using to manage the r10k gem installation? I'm sure we can troubleshoot it with enough eyes on it.

rnelson0 avatar Jul 04 '17 01:07 rnelson0

I ended up getting stuck with a chicken and egg situation with the module and dependencies since I could not get r10k to run to pull in the new dependencies. I had to manually install the r10k gem from the command line, so I'm not much help either :(

On the command line I used

/opt/puppetlabs/puppet/bin/gem install r10k

and since the latest puppet server was already at 5.0.x, it placed the r10k installation into the right version of the ruby directory (in this case 2.4.0)

WetHippie avatar Jul 04 '17 06:07 WetHippie

@WetHippie I can't help with this right now, but we can leave it open in the hopes that someone else can either verify the problem and test some fixes, or determine that it was a one-off issue. Hopefully, the next PE edition with Puppet 5 in it launches soon, and then I might be able to help myself. Thanks!

rnelson0 avatar Jul 10 '17 12:07 rnelson0

@WetHippie I experienced the same issue after upgrading my puppet master from v4.10.12 to v5.5.6 yesterday on Ubuntu 16.04. Your workaround (/opt/puppetlabs/puppet/bin/gem install r10k) worked for me as well. I believe my original r10k install was via this method, which uses the same manual install command (/opt/puppetlabs/puppet/bin/gem install r10k), so I guess it makes sense that I would need to manually install r10k again after upgrading. Sounds like @rnelson's recommendation of installing r10k via Puppet may be better and would carry over a proper r10k version across upgrades?

rsynnest avatar Sep 07 '18 16:09 rsynnest

You need to use puppetserver_gem to have puppet install the r10k gem. https://forge.puppet.com/puppetlabs/puppetserver_gem

kenyon avatar Dec 05 '18 01:12 kenyon

@kenyon Is this still necessary? Do we need to update the docs?

dhoppe avatar May 10 '19 13:05 dhoppe

@dhoppe I guess it's still necessary. This is what I do:

  Package['ruby'] -> Package <| provider == 'gem' |>

  # Ruby gems.
  lookup('gems', Array[String], 'unique').each |String $gem| {
    package { "gem_${gem}":
      ensure          => installed,
      provider        => gem,
      name            => $gem,
      install_options => ['--http-proxy', "http://${lookup('proxy.host')}:${lookup('proxy.port')}"],
    }
  }
class mysite::nodes::puppet (Array[String] $puppetserver_gems) {
  # Ruby gems for the puppetserver embedded Ruby environment.
  $puppetserver_gems.each |String $pkg| {
    package { "puppetserver_gem_${pkg}":
      ensure          => installed,
      provider        => puppetserver_gem,
      name            => $pkg,
      install_options => ['--http-proxy', "http://${lookup('proxy.host')}:${lookup('proxy.port')}"],
    }
  }
}

In hiera:

gems:
  - r10k

mysite::nodes::puppet::puppetserver_gems:
  - r10k

kenyon avatar May 11 '19 04:05 kenyon