Commit 0b8e9770 by Alexander Popov

Introduce the ComplexOptCheck superclass

parent 646cc660
...@@ -68,16 +68,11 @@ class OptCheck: ...@@ -68,16 +68,11 @@ class OptCheck:
return '{} = {}'.format(self.name, self.state) return '{} = {}'.format(self.name, self.state)
class OR: class ComplexOptCheck:
def __init__(self, *opts): def __init__(self, *opts):
self.opts = opts self.opts = opts
self.result = None self.result = None
# self.opts[0] is the option which this OR-check is about.
# Use case:
# OR(<X_is_hardened>, <X_is_disabled>)
# OR(<X_is_hardened>, <X_is_hardened_old>)
@property @property
def name(self): def name(self):
return self.opts[0].name return self.opts[0].name
...@@ -98,6 +93,13 @@ class OR: ...@@ -98,6 +93,13 @@ class OR:
def reason(self): def reason(self):
return self.opts[0].reason return self.opts[0].reason
class OR(ComplexOptCheck):
# self.opts[0] is the option which this OR-check is about.
# Use case:
# OR(<X_is_hardened>, <X_is_disabled>)
# OR(<X_is_hardened>, <X_is_hardened_old>)
def check(self): def check(self):
for i, opt in enumerate(self.opts): for i, opt in enumerate(self.opts):
result, msg = opt.check() result, msg = opt.check()
......
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