Method: Puppet::Property::KeyValue#should

Defined in:
lib/puppet/property/keyvalue.rb

#shouldObject



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/puppet/property/keyvalue.rb', line 73

def should
  return nil unless @should

  members = hashify_should
  current = process_current_hash(retrieve)

  # shared keys will get overwritten by members
  should_value = current.merge(members)

  # Figure out the keys that will actually change in our Puppet run.
  # This lets us reduce the verbosity of Puppet's logging for instances
  # of this class when we want to.
  #
  # NOTE: We use ||= here because we only need to compute the
  # changed_or_new_keys once (since this property will only be synced once).
  #
  @changed_or_new_keys ||= should_value.keys.select do |key|
    !current.key?(key) || current[key] != should_value[key]
  end

  should_value
end