Skip to content
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

build_remediations.py: deduplicate code which retrieves conditionals #9779

Conversation

vojtapolasek
Copy link
Collaborator

Description:

Code for retrieving remediation conditionals of rules was duplicated. Now the processing is defined at one place.

See commit messages for more information.

Rationale:

Deduplication of code.

RemediationObject is a namedtuple.
Before it was defined on several places.
Now it has one definition and the definition is reused.
… remediations

This commit deduplicates code.
There are two new pairs of functions created.
Two functions to get platform names of inherited conditionals or rule-specific conditionals.
These platform names can be used in the remaining two functions to get actual conditionals.
Then there is another function which strips conditionals of whitespaces at their begining or end.
These functions are used in BashRemediation and AnsibleRemediation class.
@vojtapolasek vojtapolasek added the Infrastructure Our content build system label Nov 8, 2022
@github-actions
Copy link

github-actions bot commented Nov 8, 2022

Start a new ephemeral environment with changes proposed in this pull request:

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@jan-cerny jan-cerny self-assigned this Nov 8, 2022
@jan-cerny jan-cerny added the CPE-AL CPE Applicability Language label Nov 8, 2022
@jan-cerny jan-cerny added this to the 0.1.65 milestone Nov 8, 2022
as reported by Code climate
@codeclimate
Copy link

codeclimate bot commented Nov 8, 2022

Code Climate has analyzed commit 505c061 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 88.8% (50% is the threshold).

This pull request will bring the total coverage in the repository to 46.8% (0.0% change).

View more on Code Climate.

@jan-cerny jan-cerny merged commit 5f0792d into ComplianceAsCode:master Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CPE-AL CPE Applicability Language Infrastructure Our content build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants