Creede
Creede

Reputation: 153

How to get stand-alone ohai to recognize custom plugin_path?

I have chef configured to add "/etc/chef/ohai_plugins" to Ohai::Config[:plugin_path]. However, the Chef documentation says:

"The Ohai executable ignores settings in the client.rb file when Ohai is run independently of the chef-client."

So, how can I get a stand-alone run of ohai to load and use the plugins in that custom path?

(Background: I have a custom plugin that reports some information that we keep track of for a fleet of servers, like whether a server has been patched for heartbleed or shellshock. I want to be able to run "ssh somehost ohai", parse the JSON that gets sent back, and extract the information I need.)

Thanks.

Upvotes: 0

Views: 311

Answers (2)

coderanger
coderanger

Reputation: 54251

This will be possible soon via the implementation of Chef RFC 53: https://github.com/chef/chef-rfc/blob/master/rfc053-ohai-config.md

Upvotes: 1

Roland
Roland

Reputation: 1426

Outside of chef, you can add an additional plugin path using the -d switch, e.g.

$ ohai -d /etc/chef/ohai_plugins

The relevant source code is at:

The option to specify a custom config file for Ohai was sadly removed last year with https://github.com/chef/ohai/commit/ebabd088673cf3e36d600bd96aeba004077842f1

Hope this answers your question.

Upvotes: 1

Related Questions