Method: Chef::Resource#action=

Defined in:
lib/chef/resource.rb

#action=Array[Symbol]

The action or actions that will be taken when this resource is run. Alias for normal assignment syntax.

Parameters:

  • arg (Array[Symbol], Symbol)

    A list of actions (e.g. :create)

Returns:

  • (Array[Symbol])

    the list of actions.



166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/chef/resource.rb', line 166

def action(arg = nil)
  if arg
    arg = Array(arg).map(&:to_sym)
    arg.each do |action|
      validate(
        { action: action },
        { action: { kind_of: Symbol, equal_to: allowed_actions } }
      )
    end
    @action = arg
  else
    @action
  end
end