Ohai "require_plugin" not working from ohai command line


#1

Say I have an Ohai plugin called lolcode.rb that has something like this:

require_plugin “linux::lolcode”

which delegates to another plugin by the same name located in the "linux"
subdirectory.

When I run chef-client using the ohai cookbook, I can see the node in Chef
Server being updated with the appropriate information from both plugins.
However, if I run

ohai -f lolcode.rb

The “require_plugin” seems to be completely ignored. The "linux/lolcode.rb"
plugin isn’t called. I can change the name of the directory and/or plugin to
be something completely invalid and while it doesn’t fail, it doesn’t work
either.

What am I doing wrong?


#2

On Monday, September 9, 2013 at 9:17 AM, markmaxey@verizon.net wrote:

Say I have an Ohai plugin called lolcode.rb that has something like this:

require_plugin “linux::lolcode”

which delegates to another plugin by the same name located in the "linux"
subdirectory.

When I run chef-client using the ohai cookbook, I can see the node in Chef
Server being updated with the appropriate information from both plugins.
However, if I run

ohai -f lolcode.rb

The “require_plugin” seems to be completely ignored. The "linux/lolcode.rb"
plugin isn’t called. I can change the name of the directory and/or plugin to
be something completely invalid and while it doesn’t fail, it doesn’t work
either.

What am I doing wrong?
It may be a configuration issue where your custom plugins are not in a directory that ohai is searching for plugins. Also, ohai currently is designed to ignore plugin failures. You can get stack traces and such by running with -l debug.

FYI, we’re in the middle of a pretty comprehensive overhaul of ohai that will change a lot of this stuff.


Daniel DeLeo