Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to override options to remove --no-rdoc and --no-ri for newer versions of bundler #244

Closed
nitrocode opened this issue Jan 29, 2019 · 2 comments

Comments

@nitrocode
Copy link

Cookbook version

2.1.2

Chef-client version

13.8.5

Platform Details

Ubuntu 16.04

Scenario:

Install ruby 2.6.0

Steps to Reproduce:

attributes/agent.rb

default['rbenv']['rubies'] = [
  '2.2.4',
  '2.6.0'
]
default['rbenv']['global'] = '2.2.4'
default['rbenv']['gems'] = {
  '2.2.4' => [{
      name: 'bundler',
      version: '1.16.1'
  }],
  '2.6.0' => [{
      name: 'bundler',
      version: '1.17.2'
  }]
}

recipes/agent.rb

node['rbenv']['rubies'].each do |version|
  rbenv_ruby version

  # install any gems that we need
  node['rbenv']['gems'][version].each do |gem|
    rbenv_gem gem['name'] do
      options ''
      rbenv_version version
      version gem['version']
    end
  end unless node['rbenv']['gems'].nil?

  # Rehash the rbenv environment after all the changes
  rbenv_rehash 'rehash'
end

tests/recipes/agent/default_spec.rb

control 'rbenv-rubies' do
  default['rbenv']['rubies'].each do |version|
    describe directory("/usr/local/rbenv/versions/#{version}") do
      it { should exist }
    end
  end
end

Expected Result:

Installs both ruby 2.2.4 and 2.6.0 and sets 2.2.4 to global. Then the tests run and verifies each install using their directories.

Actual Result:

It does not install because it provides the additional options --no-ri and --no-rdoc which exist for 2.2.4 but not 2.6.0

       [2019-01-29T21:08:23+00:00] ERROR: ruby_rbenv_gem[bundler] (dk-bamboo::linux-agent line 59) had an error: Mixlib::ShellOut::ShellCommandFailed: gem_package[bundler] (/tmp/kitchen/cache/cookbooks/ruby_rbenv/resources/gem.rb line 42) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
       ---- Begin output of /usr/local/rbenv/versions/2.6.0/bin/gem install bundler -q --no-rdoc --no-ri -v "1.17.2" --source=https://www.rubygems.org  ----
       STDOUT:
       STDERR: ERROR:  While executing gem ... (OptionParser::InvalidOption)
           invalid option: --no-rdoc
       ---- End output of /usr/local/rbenv/versions/2.6.0/bin/gem install bundler -q --no-rdoc --no-ri -v "1.17.2" --source=https://www.rubygems.org  ----
@nitrocode nitrocode changed the title Need to override options to remove --no-rdoc and --no-ri for newer versions of ruby Need to override options to remove --no-rdoc and --no-ri for newer versions of bundler Jan 29, 2019
@nitrocode
Copy link
Author

Nevermind. It appears that I'm using an old version of chefdk and its gem_package does not support ruby-2.6.0. I read their release notes that chefdk 14.8 supports installing ruby 2.6.0 gems.

Changing the above from 2.6.0 to 2.5.3 worked correctly.

@lock
Copy link

lock bot commented Aug 8, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant