Fix fallback command so it's actually run

This commit is contained in:
James Howe 2019-01-21 14:09:30 +00:00 committed by James Howe
parent b79a55afd3
commit 6404e2ca93

View File

@ -59,17 +59,15 @@ def zabbix_send(key, host, output):
with salt.utils.files.fopen(zbx()['config'], 'r') as file_handle:
for line in file_handle:
if "ServerActive" in line:
flag = "true"
server = line.rsplit('=')
server = server[1].rsplit(',')
for s in server:
cmd = zbx()['sender'] + " -z " + s.replace('\n', '') + " -s " + host + " -k " + key + " -o \"" + output +"\""
__salt__['cmd.shell'](cmd)
break
else:
flag = "false"
if flag == 'false':
cmd = zbx()['sender'] + " -c " + zbx()['config'] + " -s " + host + " -k " + key + " -o \"" + output +"\""
return
cmd = zbx()['sender'] + " -c " + zbx()['config'] + " -s " + host + " -k " + key + " -o \"" + output +"\""
__salt__['cmd.shell'](cmd)
def returner(ret):