Method: Chef::Provider#initialize

Defined in:
lib/chef/provider.rb

#initialize(new_resource, run_context) ⇒ Provider

Returns a new instance of Provider.



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/chef/provider.rb', line 129

def initialize(new_resource, run_context)
  @new_resource = new_resource
  @action = action
  @current_resource = nil
  @after_resource = nil
  @run_context = run_context
  @converge_actions = nil

  @logger = if run_context
              run_context.logger.with_child({ resource: new_resource.name, cookbook: cookbook_name, recipe: recipe_name })
            else
              Chef::Log.with_child({ resource: new_resource.name, cookbook: cookbook_name, recipe: recipe_name })
            end

  @recipe_name = nil
  @cookbook_name = nil
  self.class.include_resource_dsl_module(new_resource)
end