- From: Krzysztof Wilczynski <
>
- To:
- Subject: [chef] Re: Reload an ohai plugin from within a LWRP
- Date: Wed, 10 Dec 2014 23:56:32 +0000
Hi,
The "ohai" resource itself is really tiny, there isn't much to it:
https://github.com/opscode/chef/blob/master/lib/chef/resource/ohai.rb
(resource code)
https://github.com/opscode/chef/blob/master/lib/chef/provider/ohai.rb
(provider code)
So, check out `use_inline_resources` so you can just use the ohai
resource as usual, see:
-
http://docs.chef.io/lwrp.html#inline-compile-mode
-
https://docs.chef.io/lwrp_custom_provider.html#use-inline-resources
Alternatively, if you like some Ruby code, you can also try this
(inside chef-shell session):
chef:recipe > o = Chef::Resource::Ohai.new('reload-etc-plugin', run_context)
=> <ohai[reload-etc-plugin] @name: "reload-etc-plugin" @noop: nil
@before: nil @params: {} @provider: nil @allowed_actions: [:nothing,
:reload] @action: :reload @updated: false @updated_by_last_action:
false @supports: {} @ignore_failure: false @retries: 0 @retry_delay: 2
@source_line: nil @guard_interpreter: :default @elapsed_time: 0
@sensitive: false @resource_name: :ohai @plugin: nil>
chef:recipe > o.plugin('etc')
=> "etc"
chef:recipe > o.run_action(:reload)
=> nil
chef:recipe >
Hope this helps.
Best,
Krzysztof
On 10 December 2014 at 23:37, Wade Peacock
<
>
wrote:
>
Hi All,
>
>
>
>
Does anyone know how to trigger the reload on an OHAI plugin from within a
>
LWRP?
>
>
>
>
I know we could do it with notifies within a resource in a recipe, but I'd
>
rather have it happen without the notifies..
>
>
>
>
>
>
Wade Peacock
>
>
Production IT - Automation/System Engineer | Vision Critical
>
>
direct +1.604.629.9358 mobile +1.604.363.8137
>
>
web visioncritical.com | @VisionCritical on Twitter | Visit Vision
>
Critical on LinkedIn
>
>
>
>
New York | London | Hong Kong | Vancouver | Paris | San Francisco | Sydney |
>
Tokyo | Toronto | Cologne | Minneapolis | Chicago | Ottawa | Detroit
>
>
Click here to watch our clients share their Vision Critical successes:
>
www.visioncritical.com/client-stories
>
>
Archive powered by MHonArc 2.6.16.