FORBIDDEN_IVARS | = | [:@run_context, :@node, :@not_if, :@only_if] |
HIDDEN_IVARS | = | [:@allowed_actions, :@resource_name, :@source_line, :@run_context, :@name, :@node] |
allowed_actions | [RW] | |
cookbook_name | [RW] | |
delayed_notifications | [R] | |
enclosing_provider | [RW] | |
immediate_notifications | [R] | Each notify entry is a resource/action pair, modeled as an Struct with a resource and action member |
not_if_args | [R] | |
only_if_args | [R] | |
params | [RW] | |
provider | [RW] | |
recipe_name | [RW] | |
resource_name | [R] | |
retries | [RW] | |
retry_delay | [RW] | |
run_context | [RW] | |
source_line | [RW] | |
updated | [R] |
default initialize method that ensures that when initialize is finally wrapped (see below), super is called in the event that the resource definer does not implement initialize
Resources that want providers namespaced somewhere other than Chef::Provider can set the namespace with provider_base Ex:
class MyResource < Chef::Resource provider_base Chef::Provider::Deploy # ...other stuff end
If command is a block, returns false if the block returns true, true if it returns false. ("Do not run this resource if the block is true")
If the command is not a block, executes the command. If it returns a 0 exitstatus, returns false. ("Do not run this resource if the command returns 0")
command<String>: | A a string to execute. |
opts<Hash>: | Options control the execution of the command |
block<Proc>: | A ruby block to run. Ignored if a command is given. |
If command is a block, returns true if the block returns true, false if it returns false. ("Only run this resource if the block is true")
If the command is not a block, executes the command. If it returns any status other than 0, it returns false (clearly, a 0 status code is true)
command<String>: | A a string to execute. |
opts<Hash>: | Options control the execution of the command |
block<Proc>: | A ruby block to run. Ignored if a command is given. |
Iterates over all immediate and delayed notifications, calling resolve_resource_reference on each in turn, causing them to resolve lazy/forward references.
Evaluates not_if and only_if conditionals. Returns a falsey value if any of the conditionals indicate that this resource should be skipped, i.e., if an only_if evaluates to false or a not_if evaluates to true.
If this resource should be skipped, returns the first conditional that "fails" its check. Subsequent conditionals are not evaluated, so in general it‘s not a good idea to rely on side effects from not_if or only_if commands/blocks being evaluated.