Skip to content

Commit

Permalink
fix reversed logic in Datastream.has_remediation
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Jaburek <[email protected]>
  • Loading branch information
comps authored and matusmarhefka committed Apr 24, 2024
1 parent f53ff7b commit 1631fd5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/oscap.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ def parse_xml(self, xml_file):
self.rules[for_rule].fixes |= fix_type
stack.pop()

def has_no_remediation(self, rule):
def has_remediation(self, rule):
"""
Return True if 'rule' has no bash remediation, False otherwise.
Return True if 'rule' has bash remediation, False otherwise.
"""
if rule not in self.rules:
return False
# TODO: come up with a different way of handling "no remediation" cases,
# retain the current "has no *bash* remediation" behavior for now
return self.rules[rule].fixes & self.FixType.bash
return bool(self.rules[rule].fixes & self.FixType.bash)

def get_all_profiles_rules(self):
"""
Expand Down Expand Up @@ -198,7 +198,7 @@ def report_from_verbose(lines):
if status in ['pass', 'error']:
pass
elif status == 'fail':
if global_ds().has_no_remediation(rule):
if not global_ds().has_remediation(rule):
note = 'no remediation'
status = 'warn'
elif status in ['notapplicable', 'notchecked', 'notselected', 'informational']:
Expand Down

0 comments on commit 1631fd5

Please sign in to comment.