How to provide "default" options to the gem_package resource


#1

Hello guys,

I have a few nodes behind the firewall. In order to be able to install gems
I’ve got squid setup on one of the nodes outside firewall.
Now I need to provide :http_proxy option to the gem_package resource
somehow.
I need that on the nodes which are behind the firewall. I also do not want
to modify gem_package resources in all my cookbooks by adding "options {
:http_proxy => ‘http://proxy.host:3128’ }"
Is there a nice way to set the “default” options which will be applied to
all gem_package resources only on the nodes behind the firewall ?
I see the only way to patch the Chef::Resource::GemPackage#options#options
by reopenning the class and overriding method somewhere in
/etc/chef/client.rb

Are there any better ways to do that ?

Thank you,
Max


#2

nvm… I have found node[:chef_client][:http_proxy]

Thank you,
Max

On Wed, Feb 8, 2012 at 6:08 PM, Max Gorbul max@gorbul.net wrote:

Hello guys,

I have a few nodes behind the firewall. In order to be able to install
gems I’ve got squid setup on one of the nodes outside firewall.
Now I need to provide :http_proxy option to the gem_package resource
somehow.
I need that on the nodes which are behind the firewall. I also do not want
to modify gem_package resources in all my cookbooks by adding "options {
:http_proxy => ‘http://proxy.host:3128’ }"
Is there a nice way to set the “default” options which will be applied to
all gem_package resources only on the nodes behind the firewall ?
I see the only way to patch the Chef::Resource::GemPackage#options#options
by reopenning the class and overriding method somewhere in
/etc/chef/client.rb

Are there any better ways to do that ?

Thank you,
Max