Skip to content

Commit 27d1008

Browse files
author
dom
committed
Fix returned type of __output_callback arguments
1 parent d6d0068 commit 27d1008

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

swig/openscap_api.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,10 @@ def free(self):
321321
def __start_callback(self, rule, obj):
322322
return obj[0](OSCAP_Object("xccdf_rule", rule), obj[1])
323323

324-
def __output_callback(self, rule_result, obj):
325-
return obj[0](OSCAP_Object("xccdf_rule_result", rule_result), obj[1])
324+
def __output_callback(self, result, obj):
325+
# the returned object can be a rule_result or an oval_definition_result, so I extract the right name from the object repr.
326+
structure = re.findall(r"type '(struct )?(\b\S*\b)", result.__repr__())[0][1]
327+
return obj[0](OSCAP_Object(structure, rule_result), obj[1])
326328

327329
def register_start_callback(self, cb, usr):
328330
if self.object != "xccdf_policy_model":

0 commit comments

Comments
 (0)