Method: Chef::Resource#current_value

Defined in:
lib/chef/resource.rb

#current_valueObject

Get the current actual value of this resource.

This does not cache–a new value will be returned each time.

Returns:

  • A new copy of the resource, with values filled in from the actual current value.



1130
1131
1132
1133
1134
1135
1136
1137
1138
# File 'lib/chef/resource.rb', line 1130

def current_value
  provider = provider_for_action(Array(action).first)
  if provider.whyrun_mode? && !provider.whyrun_supported?
    raise "Cannot retrieve #{self.class.current_resource} in why-run mode: #{provider} does not support why-run"
  end

  provider.load_current_resource
  provider.current_resource
end