Fix import_disa_stig.py script#14835
Conversation
This change will make the script import_disa_stig.py work with product-specific control files (files in products/PRODUCT/controls directories). This will allow us to use this script to import RHEL 10 DISA STIG data.
The script import_disa_stig.py always wrote the output data to a file named "shared.yml". But, we need to write the data to product-specific files, like "rhel10.yml" because we want to import the RHEL 10 DISA STIG but we don't want to overwrite the existing data in our rules that belong to RHEL 9. This commit introduces a new "-o / --output-file-name" CLI option that allows the user to specify a different output name (defaults to "shared.yml").
The "rules" key in control files can contain both rules and variables selection. If a control in a control file contained a rule and a variable selection, the script import_disa_stig.py skipped this control with a misleading error message: "Unable to update stig_id since it doesn't have exactly one rule." Consequently, STIG data weren't imported for that control. This commit fixes the script to not process variables as rules and correctly identify the count of selected rules in a control.
|
@jan-cerny: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
This might be unrelated to the pull request, but when I run the I don't understand why it isn't able to generate the rule_dirs.json file even with the content/shared/macros/10-ansible.jinja Line 819 in a8ae5fc |
Description:
Multiple fixes in
import_disa_stig.pyscript.For more details read commit messages of all commits.
Rationale:
This change will allow us to use the script import data from manual XCCDF file from DISA STIG for RHEL 10.
Review Hints: