无法在 chef-clien 运行 期间安装 Chef gems

Unable to install Chef gems during chef-clien run

我正在使用以下版本的 Chef 环境工作

OS & 版本详情如下:

我正在运行在初始运行期间配置的节点上安装 chef-client,安装 chef gems 失败并出现以下错误。

经检查无法连接到 ruby 站点以安装 gems,但我的服务器具有活动的互联网连接。我从

获得了这些详细信息

正在安装 Cookbook Gems:

Running handlers:
[2019-10-17T19:09:35+08:00] ERROR: Running exception handlers
Running handlers complete
[2019-10-17T19:09:35+08:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 05 minutes 13 seconds
[2019-10-17T19:09:35+08:00] INFO: Sending resource update report (run-id: 942e7eaa-14c0-487d-8a6c-6d96a49c99ff)
[2019-10-17T19:09:36+08:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out
[2019-10-17T19:09:36+08:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2019-10-17T19:09:36+08:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received
 '17'
---- Begin output of bundle install ----
STDOUT: Fetching source index from https://www.rubygems.org/

Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from https://www.rubygems.org/
Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from https://www.rubygems.org/
Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from https://www.rubygems.org/
Could not fetch specs from https://www.rubygems.org/
STDERR:
---- End output of bundle install ----
Ran bundle install returned 17 

会不会是DNS问题? 我有来自服务器的有效互联网连接,可以手动登陆 ruby 站点。

有什么方法可以手动安装 ruby/cookbook 个 gem?

Can it be DNS issue? I have active internet connection from the server and can land on ruby site manually.

如果你在一个节点上运行ning chef-client,那么服务器与"active internet connection"有什么关系。您应该验证节点本身是否有可用的互联网连接。

Is there a way I can manually install ruby/cookbook gems?

当然可以。如果您希望将 rubygem 安装到 chef embedded ruby 中(与 chef_gem 资源相同),则将 gem 与 chef embedded ruby.[=20 一起使用=]

$ /opt/chef/bin/gem install <rubygem-name>

否则,您可以照常将其安装到 ruby 系统(与 gem_package 资源相同)

$ gem install <rubygem-name>

我还建议您 运行 具有调试日志级别的 chef-client 以获取有关该问题的更多信息

$ chef-client --log_level debug