wget works manually but fails in the Chef bash

193 views Asked by At

[UPDATED] modified with actual path

I wrote this script to fetch an installation file from AWS S3 bucket. It works manually using wget in terminal but failed in Chef run.

Error:

Resolving s3.amazonaws.com... failed: No address associated with hostname.
wget: unable to resolve host address “s3.amazonaws.com”

Script:

bash 'hp_file' do
  user 'root'
  cwd '/tmp'
  code <<-EOH
  wget https://s3.amazonaws.com/preprod.useast1/Platforms/HP+OM/Software_Operations_Agent_v11.14_Linux_ISO_TC200-88000.iso
  EOH
end

Any idea what went wrong? I've read some SO questions about spacing issue, but it doesn't seem to be the cause in my case. Any help is appreciated. Thanks.

1

There are 1 answers

0
display name On BEST ANSWER

Here is the solution that solved the issue. The chef client did not take the global proxy setting ($http_proxy and $https_proxy) from the machine. The fix was to modify the client.rb by adding this line:

http_proxy 'http://http-proxy.example.com:port'