-
Notifications
You must be signed in to change notification settings - Fork 452
-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ohai & $load_path #520
Comments
Digging through the code a bit
The enforce_path_sanity method call seems to make a call that strips bare the ENV['PATH'] environment variable which might be what is causing me trouble. I am going to speculate that when the plugins are reloaded within the context of a chef run this enables them to see the updated load path I am setting |
Sorry for the delay, @svmastersamurai. Any luck? Have you tried using # /etc/chef/ohai_plugins/foo.rb
require_relative '../lib/foo_collector.rb' |
Not a problem @mcquin, currently I am going through some training at work and will be away from my chef duties for a few more weeks, but I will give this a try and update this as soon as I can take a look at it! |
Hi, |
I'm trying to collect some information about the system via an ohai plugin I've written. The plugin utilizes some custom ruby classes I've developed to make things more modular. To get this to work I have a cookbook that will append to the $LOAD_PATH so it can find the classes I've written. This works when plugins are reloaded, but does not work on subsequent runs. Rather than having to reload all the plugins every chef run I am curious how to get ohai to see my custom classes without needing to reload plugins every time. I've also tried to set the local ruby environment variables RUBYLIB and RUBYLIB_PREFIX within a cookbook but to no avail =(
Ideally I would like to collect information like this
There of course is the argument to have the classes located within the plugin, which is how I was previously doing things. However, I want to be able to abstract things out and allow this library to support multiple platforms, of which I will have different members on my team contribute code to their respective operating system that they know best. Given this requirement, a particular plugin file could grow to a large size and be difficult to follow since as we expand support to more platforms.
Is this a supported use case? Would a custom gem be a better alternative than appending to the $LOAD_PATH during runtime? If so, would what would be a good way to vendor this gem?
Cheers!
The text was updated successfully, but these errors were encountered: