-
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
Add a faster alternative for generating HTML guides #11036
Conversation
The new script `generate_guides.py` builds HTML guides for each profile in the given SCAP source data stream and also it builds a HTML index. The script `generate_guides.py` applies the XSLT template `/usr/share/openscap/xsl/xccdf-guide.xsl` that is shipped in the `openscap` RPM package. That means that this tool still depends on OpenSCAP, but doesn't call the `oscap` tool. The advantage of the new solution is that the given SCAP source data stream is parsed only once, which is faster that parsing this big XML file for each profile. Unfortunately, this new script needs the `lxml` library because the `xml.etree` doesn't provide a XSLT processing feature. Therefore, we will make the usage of the new script optional and we will fall back to the existing solution if `lxml` isn't installed. This way we will improve the CI and the user's machines experience without having to break a build.
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.
Just one comment. Let me know what you think.
build-scripts/generate_guides.py
Outdated
f.write(index_source.encode("utf-8")) | ||
|
||
|
||
def generate_html_guides(ds, benchmarks, oscap_version, product, output_dir): |
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.
Code Climate is flagging this method since there are 5 parameters.
If you pulled the outer loop into main you might be able to get to four.
But I'm not too concerned about this one.
The function `generate_html_guides` has more parameters than allowed.
I have fixed Code Climate problem. |
Code Climate has analyzed commit 4c08686 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 53.8% (0.5% change). View more on Code Climate. |
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.
LGTM. Thanks for getting this done!
The new script
generate_guides.py
builds HTML guides for each profile in the given SCAP source data stream and also it builds a HTML index.The script
generate_guides.py
applies the XSLT template/usr/share/openscap/xsl/xccdf-guide.xsl
that is shipped in theopenscap
RPM package. That means that this tool still depends on OpenSCAP, but doesn't call theoscap
tool.The advantage of the new solution is that the given SCAP source data stream is parsed only once, which is faster that parsing this big XML file for each profile.
Unfortunately, this new script needs the
lxml
library because thexml.etree
doesn't provide a XSLT processing feature. Therefore, we will make the usage of the new script optional and we will fall back to the existing solution iflxml
isn't installed. This way we will improve the CI and the developer laptop experience without having to break a build.