wget 手动工作但在 Chef bash 中失败

wget works manually but fails in the Chef bash

[更新]修改为实际路径

我编写此脚本是为了从 AWS S3 存储桶中获取安装文件。它在终端中使用 wget 手动工作,但在 Chef 运行 中失败。

错误:

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

脚本:

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

知道哪里出了问题吗?我已经阅读了一些关于间距问题的 SO 问题,但它似乎不是我的原因。任何帮助表示赞赏。谢谢

这是解决问题的方法。 Chef 客户端没有从机器上获取全局代理设置($http_proxy$https_proxy)。解决方法是通过添加此行来修改 client.rb:

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