-
Notifications
You must be signed in to change notification settings - Fork 698
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
Improve service_disabled template #10026
Improve service_disabled template #10026
Conversation
They have service like: <name>@.service and are only meant to be used via socket activation. Also there is considerable speed difference between slow: systemctl list-unit-files and fast: systemctl list-unit-files <name>.<type> Use fast solution here.
Since the unit is now informed in the for the sysctl list-unit-files, the return code will already be 0 if the unit exists and 1 otherwise. So, this | grep is no longer necessary.
Code Climate has analyzed commit 7f3ef42 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 49.8% (0.0% change). View more on Code Climate. |
Can you give an example of a rule that had problems problems before and is fixed by this PR? Also, my understanding of the original pr #9468 was that there was a problem with |
Actually, this PR is not fixing any issue, but only improving the conditional. In practice, the result is the same. So, in short, neither this PR or the old one are not related to the |
Once this PR is merged, I will send another PR fixing the |
/retest |
thanks for clarification! |
Description:
This rule is a rebase for the #9468 plus some additional improvements in conditionals.
In alignment to the remediation, conditionals for systemd units were included in the two test scenario scripts by the initial PR.
After the rebase, I improved the conditionals in test scenarios and bash remediation to remove unnecessary
grep
from the command.Rationale:
Better alignment between remediation and test scenarios.
Simpler conditionals with faster commands.
Review Hints:
For testing this changes I chose some random rules which uses the
service_disabled
template.This should be enough for testing the changes.