Trying to install gem using below recipe but getting error.
chef_gem ‘install gem’ do
source '/data/kitchen-docker-2.6.0.gem’
package_name 'kitchen-docker’
action :install
end
tried using gem_package resource as well but same result.
[2017-04-13T16:02:29+10:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: chef_gem[install gem] ((chef-apply cookbook)::(chef-apply recipe) line 7) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received ‘1’
---- Begin output of /opt/chefdk/embedded/bin/gem install /data/dockergems/vendor/cache/kitchen-docker-2.6.0.gem -q --no-rdoc --no-ri -v “2.6.0” ----
STDOUT:
STDERR: ERROR: While executing gem … (URI::BadURIError)
both URI are relative
That is because source is meant to be a URL: https://docs.chef.io/resource_chef_gem.html the same is true for gem package as well I believe. It is is not typically a good idea to package gems with cookbooks. Are you doing this because you do not have internet access in your deployment?
Hi majormoses
Thanks for reply. Yes you are correct. we dont have internet access to the servers.
plan is to use artifactory (remote repo) in future. but for now i was manually trying to install gem locally and was trying to do the same using cookbook as temporary workaround.
My first thought was to use the raw ruby gem modules to check for updates, install if the gem was missing or run an update if there was a newer version. That could have worked but it just seemed like I must be reinventing a wheel so I revisited the gem_package docs.