1

I am actually having an issue while trying to write a configuration in Chef.

I have wrote a gem on my own, and pushed it to a private repository using Gem In A Box.

My recipe installs RVM and ruby successfully, but fails when tries to install the gem from the repository.

Below is the code :

rvm_gem "es_backup_s3" do
  version     "0.3.0"
  source      "http://[private_repository]:9292/gems/es_backup_s3-0.3.0.gem"
  action      :install
end

I was wondering what was the reason of the failure.

Is there a generic answer for my issue? Or should I download the gem first in the machine then trying an install from a local file?

Thanks!

[Bruno]

Suresh Karia
  • 17,550
  • 18
  • 67
  • 85
  • an error message would be most helpful. Also, it would be wise to try to install it without chef first. That way, you know the issue lies with Chef, and not with your Gem repo. – Tejay Cardon Dec 19 '14 at 14:07

1 Answers1

0

Have you tried using the higher level chef commands?

gem_package 'es_backup_s3' do
    version '0.3.0'
    source 'http://[private_repository]:9292/gems/es_backup_s3-0.3.0.gem'
    action :install
end

This should work just fine, and allow for support for more platforms (if the gem supports them)

abc123
  • 17,855
  • 7
  • 52
  • 82
  • Thank you very much for the answer! Because of that, we have made important progress. Using gem_package and leaving only the gem server name and port instead of the full path to the gem have allowed Chef to install the gem with success. A new issue appeared though; the installer did not install the gems that the installed gem depends on, even when those are specified in the Gemfile. Will be investigating this issue now. – Bruno Paiva Lima da Silva Dec 22 '14 at 14:37
  • `gem_package` should automatically take care of this, take a look at this http://guides.rubygems.org/patterns/#declaring-dependencies – abc123 Dec 22 '14 at 16:30
  • It seems that I have misunderstood the differences between .gemspec and Gemfile files. Hence, the dependencies were not set and installing my gem would not trigger the other gems it depends on. I have fixed that and everything seems to work properly now. Thank you for the advice. – Bruno Paiva Lima da Silva Dec 22 '14 at 20:29
  • @BrunoPaivaLimadaSilva not a problem – abc123 Dec 23 '14 at 05:16