Handle unreachable case in the log statistics

The unreachable status is a fail state that should be treat.

Change-Id: Ia610448421196572909567deb144d9a490be27a0
This commit is contained in:
Mathieu Bultel
2020-11-25 17:40:17 +01:00
parent be5a95d4e0
commit 0641b17a5a
3 changed files with 70 additions and 3 deletions

View File

@@ -190,6 +190,8 @@ class ValidationLog(object):
for h in self.content['stats'].keys():
if self.content['stats'][h].get('failures'):
failed += 1
if self.content['stats'][h].get('unreachable'):
failed += 1
return ('FAILED' if failed else 'PASSED')
@property
@@ -220,6 +222,8 @@ class ValidationLog(object):
for h in self.content['stats'].keys():
if self.content['stats'][h].get('failures'):
hosts.append('{},{}'.format(h, 'FAILED'))
elif self.content['stats'][h].get('unreachable'):
hosts.append('{},{}'.format(h, 'UNREACHABLE'))
else:
hosts.append('{},{}'.format(h, 'PASSED'))
return ', '.join(hosts)