Fix: Only add args.ping if it's set. (#7605)

* Only add args.ping if it's set.

* Shorter if.
This commit is contained in:
Zmegolaz
2017-11-01 18:49:38 +01:00
committed by Tony Murray
parent a7f42361ae
commit 6fcd406893

View File

@ -121,7 +121,10 @@ def scan_host(ip):
pass
try:
add_output = check_output(['/usr/bin/env', 'php', 'addhost.php', args.ping, hostname or ip])
arguments = ['/usr/bin/env', 'php', 'addhost.php', hostname or ip]
if args.ping:
arguments.insert(3, args.ping)
add_output = check_output(arguments)
return Result(ip, hostname, Outcome.ADDED, add_output)
except CalledProcessError as err:
output = err.output.decode().rstrip()