mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
diagnose: Move negating diagnose result inside try bock
A caught Exception should always be considered a failed test. Signed-off-by: Matthias Dellweg <2500@gmx.de> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
aca0c65d68
commit
cb3e050722
@ -423,12 +423,14 @@ def diagnose_netcat(host, port, input='', negate=False):
|
||||
result = 'failed'
|
||||
else:
|
||||
result = 'passed'
|
||||
|
||||
if negate:
|
||||
result = 'failed' if result == 'passed' else 'passed'
|
||||
except Exception:
|
||||
result = 'failed'
|
||||
|
||||
test = _('Connect to {host}:{port}')
|
||||
if negate:
|
||||
result = 'failed' if result == 'passed' else 'passed'
|
||||
test = _('Cannot connect to {host}:{port}')
|
||||
|
||||
return [test.format(host=host, port=port), result]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user