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

ensure_logrotate_activated: Check timers.target.wants as well #12683

Conversation

yuumasato
Copy link
Member

@yuumasato yuumasato commented Dec 6, 2024

Description:

  • Expand check to also verify systemd timers.target.wants directory. Some systems may not have logrotate.timers defined in multi-user.target.wants.

Rationale:

    helpers.go:872: Result - Name: e2e-high-master-ensure-logrotate-activated - Status: FAIL - Severity: medium
    helpers.go:879: E2E-FAILURE: The expected remediated result for the e2e-high-master-ensure-logrotate-activated rule didn't match. Expected 'PASS', Got 'FAIL' 

Review Hints:

  • Check that tests pass, :P

Additional information:

Debugging a 4.17 node:

sh-5.1# cat /etc/redhat-release 
Red Hat Enterprise Linux CoreOS release 4.17
sh-5.1# 
sh-5.1# file /etc/systemd/system/timers.target.wants/logrotate.timer
/etc/systemd/system/timers.target.wants/logrotate.timer: symbolic link to /usr/lib/systemd/system/logrotate.timer
sh-5.1# 
sh-5.1# file /etc/systemd/system/multi-user.target.wants/logrotate.timer
/etc/systemd/system/multi-user.target.wants/logrotate.timer: cannot open `/etc/systemd/system/multi-user.target.wants/logrotate.timer' (No such file or directory)

On 1minutetip machine:

[root@vm-10-0-186-171 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 9.6 Beta (Plow)
[root@vm-10-0-186-171 ~]# 
[root@vm-10-0-186-171 ~]# file /etc/systemd/system/timers.target.wants/logrotate.timer
/etc/systemd/system/timers.target.wants/logrotate.timer: symbolic link to /usr/lib/systemd/system/logrotate.timer
[root@vm-10-0-186-171 ~]# 
[root@vm-10-0-186-171 ~]# file /etc/systemd/system/multi-user.target.wants/logrotate.timer
/etc/systemd/system/multi-user.target.wants/logrotate.timer: cannot open `/etc/systemd/system/multi-user.target.wants/logrotate.timer' (No such file or directory)

Expand check to also verify systemd timers.target.wants directory.
Some systems may not have logrotate.timers defined in
multi-user.target.wants.
@yuumasato yuumasato added OpenShift OpenShift product related. RHEL9 Red Hat Enterprise Linux 9 product related. RHEL10 Red Hat Enterprise Linux 10 product related. labels Dec 6, 2024
@yuumasato yuumasato added this to the 0.1.76 milestone Dec 6, 2024
@yuumasato yuumasato requested a review from jan-cerny December 6, 2024 15:08
@yuumasato
Copy link
Member Author

/test 4.17-e2e-aws-rhcos4-high
/test 4.12-e2e-aws-rhcos4-high

Copy link

github-actions bot commented Dec 6, 2024

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

rhel8 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

Copy link

codeclimate bot commented Dec 6, 2024

Code Climate has analyzed commit a29b458 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 60.9% (0.0% change).

View more on Code Climate.

Copy link
Collaborator

@rhmdnd rhmdnd left a comment

Choose a reason for hiding this comment

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

/lgtm

@rhmdnd
Copy link
Collaborator

rhmdnd commented Dec 9, 2024

/test 4.14-images

@rhmdnd rhmdnd merged commit 18a737b into ComplianceAsCode:master Dec 9, 2024
103 of 107 checks passed
@yuumasato yuumasato deleted the ensure_logrotate_activated_on_timers.target.wants branch December 9, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OpenShift OpenShift product related. RHEL9 Red Hat Enterprise Linux 9 product related. RHEL10 Red Hat Enterprise Linux 10 product related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants