Provider - load_current_resource


#1

Hello,

How can I make into a provider that a variable will be re-initialized ?

Example:

providers/default.rb

def load_current_resource
@current_resource.var = i_set_my_resource(@new_resource.name)
end

At some point I need to re-init @current_resource.var.

thanks!


#2

On Wednesday, November 20, 2013 at 11:02 AM, Silviu Dicu wrote:

Hello,

How can I make into a provider that a variable will be re-initialized ?

Example:

providers/default.rb

def load_current_resource
@current_resource.var = i_set_my_resource(@new_resource.name)
end

At some point I need to re-init @current_resource.var.

thanks!

Generally anything that appears in a DSL in chef uses a combined getter-setter, where:

thing.value() # return the current value

thing.value(a_new_value) # set the value 

HTH,


Daniel DeLeo