0

I am working on a chef environment with below versions

OS & Version details are as below:

  • Chef Server - RHEL7
  • Chef Workstation - Windows 7 Professional
  • Chef node : Windows 2016 Server Datacenter
  • Chef Development Kit Version: 3.3.23
  • chef-client version: 14.14.25
  • berks version: 7.0.6
  • kitchen version: 1.23.2
  • inspec version: 2.2.112

I am running a chef-client on a node which is configured during initial run installing chef gems failed with below errors.

On checking it was not able to connect to ruby site to install gems, but my server has active internet connection. I got these details from Bundle Install Not Working

Installing 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 

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

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

Mr.
  • 9,429
  • 13
  • 58
  • 82

1 Answers1

2

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

if you are running chef-client on a node, then what the server has to do with "active internet connection". you should verify that an internet connection is available on the node itself.

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

sure you can. if you wish to install a rubygem into chef embedded ruby (same as chef_gem resource), then use gem with chef embedded ruby.

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

otherwise, you can install it to the ruby system as usuall (same as gem_package resource)

$ gem install <rubygem-name>

i also advise you to run chef-client with debug log level to get more information about the problem

$ chef-client --log_level debug
Mr.
  • 9,429
  • 13
  • 58
  • 82
  • I don't find gem executable file in node, I am working on windows environment.Do we have same setup in windows chef node as well ? – Sankareswar Oct 17 '19 at 17:47
  • @Sankareswar: if you will execute chef-client with debug log level, chef installation path will be revealed to you. another way, is to search the file system for chef and there you will find the embedded ruby. – Mr. Oct 17 '19 at 19:30
  • Even if I try installing gems manually using ```$gem install```. It is throwing an error saying timeout. ```PS C:\opscode\chef\embedded\bin> .\gem.cmd install addressable ERROR: Could not find a valid gem 'addressable' (>= 0), here is why: Unable to download data from https://rubygems.org/ - timed out (https://api.rubygems.org/specs.4.8.gz)``` Can we copy gems installed on any of the machine and use this for running chef-client ? – Sankareswar Oct 18 '19 at 12:23
  • @Sankareswar: please read my answer and verify that your node has an internet connection. ...some rubygems are compiled during their installation, so copy an installed rubygem, might not work for you on the destination node. – Mr. Oct 18 '19 at 14:52