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

Options should be a kind_of String #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Options should be a kind_of String #83

wants to merge 1 commit into from

Conversation

jgeiger
Copy link

@jgeiger jgeiger commented Dec 30, 2013

From https://github.com/opscode/chef/blob/master/lib/chef/provider/package/rubygems.rb

Line 369-71:
If you have a gem_binary specified, you cannot have options as a Hash.

Line 377-80
If you're using Omnibus, your options should be a String.

Also, there doesn't seem to be any example of how to use options as a hash so it's not clear how to do something like "--force".

From the code in
https://github.com/opscode/chef/blob/master/lib/chef/provider/package/rubygems.rb

If you have a gem_binary specified, you cannot have options as a Hash.
If you're using Omnibus, your options should be a string.
@caleb
Copy link

caleb commented Jan 15, 2014

I'd love to see this merged. As it is, you can't use the options attribute. If you pass a Hash (as is allowed by this cookbook) it gets shot down by chef, and if you pass a string it is disallowed by this cookbook.

@liku
Copy link

liku commented Mar 14, 2014

+1

@ghost
Copy link

ghost commented Mar 17, 2014

Just tried to debug this options thing. Could it be, that options isn't used at all? Or do I just miss where opts gets passed into the install_via_gem_command function? https://github.com/RiotGames/rbenv-cookbook/blob/master/libraries/provider_rbenv_rubygems.rb#L88

@jgeiger
Copy link
Author

jgeiger commented Mar 17, 2014

It's on the end of that line...

"#{gem_binary_path} install #{name} -q --no-rdoc --no-ri #{version_option} #{src}#{opts}"

@ghost
Copy link

ghost commented Mar 17, 2014

@jgeiger Yeah, that's where it is used, but how/where is it defined / passed into the function?

@jgeiger
Copy link
Author

jgeiger commented Mar 17, 2014

Likely somewhere higher up the chain. Don't have a lot of time to search but a quick look at
https://github.com/opscode/chef/blob/master/lib/chef/provider/package/rubygems.rb

shows it's being used inside the method at 531.

@ghost
Copy link

ghost commented Mar 17, 2014

@jgeiger thanks!

@jeremyolliver
Copy link

👍 This is biting me as well. I'm in the unfortunate position of being in an environment needing a proxy. There's no environment option for rbenv_gem, so it kinda hurts that options is unusable as well

@caleb
Copy link

caleb commented Mar 19, 2014

Until this is fixed, I've been using this hack in my own rbenv wrapper cookbook:

# Change the rbenv cookbook to make options accept a String or a Hash
Chef::Resource::RbenvGem.send :define_method, :_set_or_return_options do |arg|
   set_or_return(:options, arg, { :kind_of => [String, Hash] })
end

@svanharmelen
Copy link

+1

@YanhaoYang
Copy link

Yes, this should be merged. I am getting following error:

==> default: ArgumentError
==> default: -------------
==> default: options should be a string instead of a hash
==> default: in rbenv_gem[rake] from /tmp/vagrant-chef-3/chef-solo-1/cookbooks/gco/recipes/default.rb:25:in `from_file'
==> default:
==> default:
==> default: Cookbook Trace:
==> default: ---------------
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/rbenv/libraries/provider_rbenv_rubygems.rb:64:in `initialize'
==> default:
==> default:
==> default: Resource Declaration:
==> default: ---------------------
==> default: # In /tmp/vagrant-chef-3/chef-solo-1/cookbooks/gco/recipes/default.rb
==> default:
==> default:  25: rbenv_gem "rake" do
==> default:  26:   ruby_version "2.1.2"
==> default:  27:   options force: true
==> default:  28: end
==> default:  29:

@jmccann
Copy link

jmccann commented Mar 4, 2015

@caleb Does your workaround still work for you in Chef 12.1.0? It seems to work for me in <= 12.0.3 but doesn't in 12.1.0 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants