Issue with chef, ruby, and restclient


#1

I apologize for asking this but I have been beating my head against a wall for almost 3 days in efforts to find a solution.

I inherited a chef server running chef 10.18.2 and while I am not perplexed by it much, the challenges it has placed upon me are ‘challenging’

I have a node that is behind a proxy. I added http_proxy and https_proxy to /etc/chef/client.rb.

When I run a chef-client, it connects until it hits a reference to RestClient.get which is not going through the proxy(I have confirmed this by watching the cisco asa that is acting as the proxy, everything goes through the proxy until this at which time it tries to connect directly to the chef-server.)

I freely admit I need to learn more about ruby and chef to be able to admin this better, but could anyone please tell me how to either change the ENV for Rest or RestClient? I have researched this and keep finding references to adding it in to the restclient.rb which I have found, but adding to the .rb makes no changes.

I am at my wits end and I need a good solution.

Thank you in advance.


#2

Let me rephrase my question. I am looking at chef-client cookbook, specifically the client.rb.erb template. Where do I put the http_proxy/https_proxy in? Does it go in the client.rb.erb template, and if so where? Or is there a different file this would reside in when I build the cookbook? I have several nodes, I am thinking if it is the client.rb.erb, I can build a new cookbook and use it to build a new role for the nodes behind the proxy.

Help?!?

From: Dave Patton [mailto:dpatton@newground.com]
Sent: Thursday, August 15, 2013 2:46 PM
To: chef@lists.opscode.com
Subject: [chef] issue with chef, ruby, and restclient

I apologize for asking this but I have been beating my head against a wall for almost 3 days in efforts to find a solution.

I inherited a chef server running chef 10.18.2 and while I am not perplexed by it much, the challenges it has placed upon me are ‘challenging’

I have a node that is behind a proxy. I added http_proxy and https_proxy to /etc/chef/client.rb.

When I run a chef-client, it connects until it hits a reference to RestClient.get which is not going through the proxy(I have confirmed this by watching the cisco asa that is acting as the proxy, everything goes through the proxy until this at which time it tries to connect directly to the chef-server.)

I freely admit I need to learn more about ruby and chef to be able to admin this better, but could anyone please tell me how to either change the ENV for Rest or RestClient? I have researched this and keep finding references to adding it in to the restclient.rb which I have found, but adding to the .rb makes no changes.

I am at my wits end and I need a good solution.

Thank you in advance.


#3

Dave,
I’d try the following (with the disclaimer that I’ve never used chef-client
behind a proxy).

Quick hack: add ENV[‘http_proxy’] = “my_proxy_value” to client.rb
Better way: Set the [“chef_client”][“config”][“http_proxy”] attribute on
the role or node where you’re using the chef-client cookbook.

If you’re just getting started with chef then you may find
https://learnchef.opscode.com useful too

  • Luke

On 15 August 2013 22:55, Dave Patton dpatton@newground.com wrote:

Let me rephrase my question. I am looking at chef-client cookbook,
specifically the client.rb.erb template. Where do I put the
http_proxy/https_proxy in? Does it go in the client.rb.erb template, and if
so where? Or is there a different file this would reside in when I build
the cookbook? I have several nodes, I am thinking if it is the
client.rb.erb, I can build a new cookbook and use it to build a new role
for the nodes behind the proxy.****


Help?!?****


From: Dave Patton [mailto:dpatton@newground.com]
Sent: Thursday, August 15, 2013 2:46 PM
To: chef@lists.opscode.com
Subject: [chef] issue with chef, ruby, and restclient****


I apologize for asking this but I have been beating my head against a wall
for almost 3 days in efforts to find a solution.****


I inherited a chef server running chef 10.18.2 and while I am not
perplexed by it much, the challenges it has placed upon me are ‘challenging’



I have a node that is behind a proxy. I added http_proxy and https_proxy
to /etc/chef/client.rb.****


When I run a chef-client, it connects until it hits a reference to
RestClient.get which is not going through the proxy(I have confirmed this
by watching the cisco asa that is acting as the proxy, everything goes
through the proxy until this at which time it tries to connect directly to
the chef-server.)****


I freely admit I need to learn more about ruby and chef to be able to
admin this better, but could anyone please tell me how to either change the
ENV for Rest or RestClient? I have researched this and keep finding
references to adding it in to the restclient.rb which I have found, but
adding to the .rb makes no changes.****


I am at my wits end and I need a good solution. ****


Thank you in advance. ****