Skip to content

Commit

Permalink
fix rerun of socket port
Browse files Browse the repository at this point in the history
When using puppet it always returns returns as sync, the value of port
is an int in the file on disk but in the catalouge it's a string. This
commit uses insync?(is) to always convert socket[:port] to an integer
  • Loading branch information
antonlindstrom committed Oct 21, 2013
1 parent 78e122a commit 05ba145
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/puppet/type/sensu_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,28 @@ def initialize(*args)

newproperty(:socket) do
desc "Socket information used by the udp type"

def is_to_s(hash = @is)
hash.keys.sort.map {|key| "#{key} => #{hash[key]}"}.join(", ")
end

def should_to_s(hash = @should)
hash.keys.sort.map {|key| "#{key} => #{hash[key]}"}.join(", ")
end

def insync?(is)
if defined? @should[0]
if is['port'] == (@should[0]['port'] = @should[0]['port'].to_i)
true
else
false
end
else
true
end
end

defaultto {}
end

newproperty(:mutator) do
Expand Down

0 comments on commit 05ba145

Please sign in to comment.