sensu / sensu-chef

Sensu Chef cookbook.
https://supermarket.chef.io/cookbooks/sensu
Apache License 2.0
222 stars 283 forks source link

Document how to install gems into a non embedded ruby setup #599

Closed gerard76 closed 6 years ago

gerard76 commented 6 years ago

When embedded_ruby is set to false I expect sensu-gem not to use the embedded sensu ruby.

in Sensu::Helpers gem_binary is defined as

def gem_binary
 if File.exists?("/opt/sensu/embedded/bin/gem")
  "/opt/sensu/embedded/bin/gem"
 elsif File.exists?('c:\opt\sensu\embedded\bin\gem.bat')
  'c:\opt\sensu\embedded\bin\gem.bat'
 else
  "gem"
 end
end

Because /opt/sensu/embedded/bin/gem is installed regardless of the embedded_ruby setting and the helper does not look at the setting the embedded sensu ruby is used for installing gems.

I expect the system ruby to be used when embedded_ruby is set to false.

majormoses commented 6 years ago

Thanks for reporting this though I don't see that in scope of this cookbook, sensu_gem is specifically for sensu embedded ruby. If you are not using it then you should use gem_package which sensu_gem is just a wrapper for gem_package specifically to help people with the embedded ruby.

See: https://github.com/sensu/sensu-chef/blob/v4.1.0/providers/gem.rb for example useage and give it the path the the non embedded ruby.

Also I don't recommend using a system wide ruby for sensu anyways as it can have system wide consequences for installing new gems. For example installing a new version of sesu-plugins-chef in some cases would upgrade the actual chef-client version which is probably not desirable.

@thomasriley @cwjohnston do you feel differently?

gerard76 commented 6 years ago

You are right, I can (and should) use gem_package.

In this case I am forced to use the system ruby because of incompatibilities between sensu ssl and the sensu-plugins-postgres package.

majormoses commented 6 years ago

You can use this to work around the postgres issues I believe: https://github.com/sensu-plugins/sensu-pg

majormoses commented 6 years ago

@gerard-leijdekkers any chance you could create a PR to document this for other users with this question? If not I will do it when I have the time (likely this weekend).

majormoses commented 6 years ago

closed via #601