Method: Chef::Resource#state_for_resource_reporter

Defined in:
lib/chef/resource.rb

#state_for_resource_reporterHash{Symbol => Object}

Get the value of the state attributes in this resource as a hash.

Does not include properties that are not set (unless they are identity properties).

Returns:

  • (Hash{Symbol => Object})

    A Hash of attribute => value for the Resource class’s state_attrs.



506
507
508
509
510
511
512
513
514
515
# File 'lib/chef/resource.rb', line 506

def state_for_resource_reporter
  state = {}
  state_properties = self.class.state_properties
  state_properties.each do |property|
    if property.is_set?(self)
      state[property.name] = property.sensitive? ? "*sensitive value suppressed*" : send(property.name)
    end
  end
  state
end