Reload ohai plugins from provider?


#1

I have a provider that changes some ohai plugin provided attributes. How can I tell ohai to reload its plugins from the provider? notifies :reload, "ohai[custom_plugins]", :immediately doesn’t seem to work there.

Wes


#2

On 4 Aug 2012, at 19:49, Wes Morgan wrote:

I have a provider that changes some ohai plugin provided attributes. How can I tell ohai to reload its plugins from the provider? notifies :reload, "ohai[custom_plugins]", :immediately doesn’t seem to work there.

Wes

I haven’t used an ohai plugin myself but I think the nginx cookbook does it by simply including the ohai receipe (https://github.com/opscode-cookbooks/nginx/blob/master/recipes/ohai_plugin.rb ) which in turn delegates to

However I suspect this won’t work correctly if this happens more than once during a run - you might be able to get around it via a ruby block resource

-ash


#3

This ended up working:

ohai_plugins = Chef::Resource::Ohai.new("custom_plugins", run_context)
ohai_plugins.run_action(:reload)

Wes

On Aug 4, 2012, at 2:05 PM, Ash Berlin ash_opscode@firemirror.com wrote:

On 4 Aug 2012, at 19:49, Wes Morgan wrote:

I have a provider that changes some ohai plugin provided attributes. How can I tell ohai to reload its plugins from the provider? notifies :reload, "ohai[custom_plugins]", :immediately doesn’t seem to work there.

Wes

I haven’t used an ohai plugin myself but I think the nginx cookbook does it by simply including the ohai receipe (https://github.com/opscode-cookbooks/nginx/blob/master/recipes/ohai_plugin.rb ) which in turn delegates to

https://github.com/opscode-cookbooks/ohai/blob/master/recipes/default.rb

However I suspect this won’t work correctly if this happens more than once during a run - you might be able to get around it via a ruby block resource

-ash