Skip to content

Commit 05ba145

Browse files
fix rerun of socket port
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
1 parent 78e122a commit 05ba145

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

lib/puppet/type/sensu_handler.rb

+22
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,28 @@ def initialize(*args)
3939

4040
newproperty(:socket) do
4141
desc "Socket information used by the udp type"
42+
43+
def is_to_s(hash = @is)
44+
hash.keys.sort.map {|key| "#{key} => #{hash[key]}"}.join(", ")
45+
end
46+
47+
def should_to_s(hash = @should)
48+
hash.keys.sort.map {|key| "#{key} => #{hash[key]}"}.join(", ")
49+
end
50+
51+
def insync?(is)
52+
if defined? @should[0]
53+
if is['port'] == (@should[0]['port'] = @should[0]['port'].to_i)
54+
true
55+
else
56+
false
57+
end
58+
else
59+
true
60+
end
61+
end
62+
63+
defaultto {}
4264
end
4365

4466
newproperty(:mutator) do

0 commit comments

Comments
 (0)