Class: PuppetX::Sensu::HashOfStringsProperty

Inherits:
Puppet::Property
  • Object
show all
Defined in:
lib/puppet_x/sensu/hash_of_strings_property.rb

Instance Method Summary collapse

Instance Method Details

#change_to_s(currentvalue, newvalue) ⇒ Object



29
30
31
32
33
# File 'lib/puppet_x/sensu/hash_of_strings_property.rb', line 29

def change_to_s(currentvalue, newvalue)
  currentvalue = currentvalue.to_s if currentvalue != :absent
  newvalue = newvalue.to_s
  super(currentvalue, newvalue)
end

#insync?(is) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/puppet_x/sensu/hash_of_strings_property.rb', line 13

def insync?(is)
  ignore_labels = [
    'sensu.io/managed_by',
  ]
  # Ignore some labels that are auto generated by sensuctl
  if self.name == :labels && is.is_a?(Hash)
    new_is = {}
    is.each_pair do |key, value|
      next if ignore_labels.include?(key)
      new_is[key] = value
    end
    is = new_is
  end
  super(is)
end

#is_to_s(currentvalue) ⇒ Object Also known as: should_to_s



35
36
37
# File 'lib/puppet_x/sensu/hash_of_strings_property.rb', line 35

def is_to_s(currentvalue)
  currentvalue.to_s
end