F #3380: Add timeout support for hooks (#3766)

This commit is contained in:
Christian González authored and Ruben S. Montero committed 2019-09-25 16:29:33 +02:00
1 parent 5ee0e6a4a4
commit 297350ece9
1 file changed
+10 -2
+10 -2
View File
@@ -139,10 +139,12 @@ module HEMHook
command.concat(" #{params}")
end
_timeout = timeout
if !remote?
LocalCommand.run(command, nil, stdin, nil)
LocalCommand.run(command, nil, stdin, _timeout)
elsif !host.empty?
SSHCommand.run(command, host, nil, stdin, nil)
SSHCommand.run(command, host, nil, stdin, _timeout)
else
return -1
end
@@ -176,6 +178,12 @@ module HEMHook
astdin.zero?
end
def timeout
return self['TEMPLATE/TIMEOUT'].to_i if !self['TEMPLATE/TIMEOUT'].nil?
nil
end
# Generates a key for a given hook
def key
begin