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

Fix scap delta tailoring #11145

Merged
merged 4 commits into from
Sep 27, 2023

Conversation

Mab879
Copy link
Member

@Mab879 Mab879 commented Sep 26, 2023

Description:

  • Fix deprecation warning for Python 3.12
  • Fix case when invalid profile was pass the script returned a non-helpful error
  • Fix the script so it didn't always return false for every element

Rationale:

Ensure the scripts works and is usable in future versions of Python.

Review Hints:

See each commit for more details.

Fix an issue in utils/create_scap_delta_tailoring.py
… not found

Before this a call on None would cause the script to error out.
@Mab879 Mab879 added the Infrastructure Our content build system label Sep 26, 2023
@Mab879 Mab879 added this to the 0.1.70 milestone Sep 26, 2023
@github-actions
Copy link

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

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@@ -178,7 +179,7 @@ def create_tailoring(args):

tailoring_root = ET.Element('xccdf-1.2:Tailoring')
version = ET.SubElement(tailoring_root, 'xccdf-1.2:version',
attrib={'time': datetime.datetime.utcnow().isoformat()})
attrib={'time': datetime.datetime.now(datetime.UTC).isoformat()})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the CI results we see that the new way doesn't work with Python 2.7 and 3.6 which we still support. The function hasn't been removed from 3.12, it's only deprecated. So I see 2 options: 1. don't do this change now, 2. create a wrapper function that would call either now(datetime.UTC) or utcnow depending on Python version or their presence.

@jan-cerny jan-cerny self-assigned this Sep 27, 2023
@codeclimate
Copy link

codeclimate bot commented Sep 27, 2023

Code Climate has analyzed commit fac076c 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 56.9%.

View more on Code Climate.

@jan-cerny jan-cerny merged commit 9e934b3 into ComplianceAsCode:master Sep 27, 2023
38 checks passed
@Mab879 Mab879 deleted the fix_scap_delta_tailoring branch September 27, 2023 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Our content build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants