-
Notifications
You must be signed in to change notification settings - Fork 685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce OCIL size #11577
Reduce OCIL size #11577
Conversation
Skipping CI for Draft Pull Request. |
6aa1290
to
8875821
Compare
ssg/build_yaml.py
Outdated
@@ -1547,7 +1549,7 @@ def export_benchmark_to_file(self, filename): | |||
register_namespaces() | |||
return self.benchmark.to_file(filename, self.env_yaml) | |||
|
|||
def export_ocil_to_xml(self): | |||
def _get_enpty_ocil_xml(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't something like create_ocil_xml_skeleton be better?
ssg/build_yaml.py
Outdated
if not rule.ocil and not rule.ocil_clause: | ||
continue | ||
questionnaire, action, boolean_question = rule.to_ocil() | ||
questionnaires.append(questionnaire) | ||
test_actions.append(action) | ||
questions.append(boolean_question) | ||
|
||
def _get_rules_from_benchamrk(self, benchmark): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
benchmark
ssg/build_yaml.py
Outdated
return root, questionnaires, test_actions, questions | ||
|
||
@staticmethod | ||
def _set_ocil_rules(rules, questionnaires, test_actions, questions): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set_ocil_rules is a misleading name. Try something like add_rules_to_ocil?
ssg/build_yaml.py
Outdated
@@ -1563,13 +1565,28 @@ def export_ocil_to_xml(self): | |||
questionnaires = ET.SubElement(root, "{%s}questionnaires" % ocil_namespace) | |||
test_actions = ET.SubElement(root, "{%s}test_actions" % ocil_namespace) | |||
questions = ET.SubElement(root, "{%s}questions" % ocil_namespace) | |||
for rule in self.rules.values(): | |||
return root, questionnaires, test_actions, questions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should return just root because the other items can be easily accessed trough root.
Code Climate has analyzed commit 90de0f7 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 33.3% (50% is the threshold). This pull request will bring the total coverage in the repository to 58.4% (0.0% change). View more on Code Climate. |
/packit retest-failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reviewed the code. I have seen the generated OCIL file.
Description:
This PR reduces the size of the generated OCIL. It uses the OCIL from the selected rules in the Datastream. The difference between the Datastreams is 1 MB. It also automatically formats XCCDF and OCIL, but Python formatting is available in
python3
. Once support forpython2
is discontinued, it will be possible to remove the XML formatting steps from the build.