Commit 337f806f by Alexander Popov

Turn some error conditions into assertions (part 2)

parent 3ff6e747
...@@ -252,9 +252,10 @@ class OR(ComplexOptCheck): ...@@ -252,9 +252,10 @@ class OR(ComplexOptCheck):
self.result = 'OK: {} not found'.format(opt.name) self.result = 'OK: {} not found'.format(opt.name)
elif opt.result == 'OK: is present': elif opt.result == 'OK: is present':
self.result = 'OK: {} is present'.format(opt.name) self.result = 'OK: {} is present'.format(opt.name)
# VersionCheck provides enough info else:
elif not opt.result.startswith('OK: version'): # VersionCheck provides enough info
sys.exit('[!] ERROR: unexpected OK description "{}"'.format(opt.result)) assert(opt.result.startswith('OK: version')), \
'unexpected OK description "{}"'.format(opt.result)
return return
self.result = self.opts[0].result self.result = self.opts[0].result
...@@ -282,8 +283,8 @@ class AND(ComplexOptCheck): ...@@ -282,8 +283,8 @@ class AND(ComplexOptCheck):
else: else:
# VersionCheck provides enough info # VersionCheck provides enough info
self.result = opt.result self.result = opt.result
if not opt.result.startswith('FAIL: version'): assert(opt.result.startswith('FAIL: version')), \
sys.exit('[!] ERROR: unexpected FAIL description "{}"'.format(opt.result)) 'unexpected FAIL description "{}"'.format(opt.result)
return return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment