Method: Puppet::Transaction::Event#calculate_corrective_change

Defined in:
lib/puppet/transaction/event.rb

#calculate_corrective_change(old_system_value) ⇒ bool

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Calculate and set the corrective_change parameter, based on the old_system_value of the property.

Parameters:

  • old_system_value (Object)

    system_value from last transaction

Returns:

  • (bool)

    true if this is a corrective_change



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/puppet/transaction/event.rb', line 142

def calculate_corrective_change(old_system_value)
  # Only idempotent properties, and cases where we have an old system_value
  # are corrective_changes.
  if @property_instance.idempotent? &&
     !@property_instance.sensitive &&
     !old_system_value.nil?

    # If the values aren't insync, we have confirmed a corrective_change
    insync = @property_instance.insync_values?(old_system_value, previous_value)

    # Preserve the nil state, but flip true/false
    @corrective_change = insync.nil? ? nil : !insync
  else
    @corrective_change = false
  end
end