This did the trick
https://docs.chef.io/lwrp_custom_provider.html#use-inline-resources
Thanks for the tip.
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
-----Original Message-----
From: kswilczynski@gmail.com [mailto:kswilczynski@gmail.com ] On Behalf Of Krzysztof Wilczynski
Sent: Wednesday, December 10, 2014 3:57 PM
To: chef@lists.opscode.com
Subject: [chef] Re: Reload an ohai plugin from within a LWRP
Hi,
The "ohai" resource itself is really tiny, there isn't much to it:
#
# Author:: Michael Leinartas (<mleinartas@gmail.com>)
# Author:: Tyler Cloke (<tyler@chef.io>)
# Copyright:: Copyright 2010-2016, Michael Leinartas
# Copyright:: Copyright (c) Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
This file has been truncated. show original
(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:
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 Wade.Peacock@visioncritical.com 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