lib/garcon/chef/chef_helpers.rb
# Adds a `run_now` method onto Resources so you can immediately execute
# the resource block. This is a shortcut so you do not have to set the
# action to :nothing, and then use the `.run_action` method with the
# desired action.
#
# @example
#     service 'sshd' do
#       action [:enable, :start]
#     end.run_now
#
Adds a `run_now` method onto Resources so you can immediately execute
the resource block. This is a shortcut so you do not have to set the
action to :nothing, and then use the `.run_action` method with the
desired action.
Adds a ` run_now ` method onto Resources so you can immediately execute the resource block . This is a shortcut so you do not have to set the action to : nothing and then use the ` . run_action ` method with the desired action .
def run_now(resource = nil)
      resource ||= self
      actions = Array(resource.action)
      Chef::Log.debug "Immediate execution of #{resource.name} #{actions}"
      resource.action(:nothing)
      actions.each { |action| resource.run_action(action) }
    end
def run_now ( resource = nil ) resource ||= self actions = Array ( resource . action ) Chef :: Log . debug "Immediate execution of #{resource.name} #{actions}" resource . action ( :nothing ) actions . each { | action | resource . run_action ( action ) } end
Adds a `run_now` method onto Resources so you can immediately execute
the resource block.
Adds a ` run_now ` method onto Resources so you can immediately execute the resource block .
resource
<not_specific>
example
service 'sshd' do action [:enable, :start] end.run_now
service ' sshd ' do action [ : enable : start ] end . run_now