-
Notifications
You must be signed in to change notification settings - Fork 5.6k
fix systemd_service.get_enabled, get_disabled and get_static on newer systemd version #59525
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
Conversation
|
@Vaarlion we no longer use the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some tests for the two different outputs to unit/modules/test_systemd_service.py
Also, please rebase this against the master branch. Develop is no longer used...
|
Dammit ! i explicitly rebased from master to develop :( |
in older systemd version, the output of list-unit-files looked like this ``` boot-complete.target static cryptsetup-pre.target static cryptsetup.target static ctrl-alt-del.target disabled default.target static emergency.target static exit.target disabled final.target static getty-pre.target static getty.target static graphical.target static halt.target disabled ``` with only 2 fields, The unit name and the enabled state. On newer version of systemd, they added a new field, the VENDOR_PRESET ``` boot-efi.mount generated - boot.mount generated - dev-hugepages.mount static - dev-mqueue.mount static - home-guillaumedk-.steam-library.mount enabled disabled home-guillaumedk-Nas.mount disabled disabled home.mount generated - mnt-media.mount disabled disabled proc-fs-nfsd.mount static - proc-sys-fs-binfmt_misc.mount disabled disabled run-vmblock\x2dfuse.mount disabled disabled sys-fs-fuse-connections.mount static - sys-kernel-config.mount static - sys-kernel-debug.mount static - ``` Resulting in issue when parsed by this script. `unit_state` would look like `'static -'` This fix allow any number of field to be split, but only keep the first 2.
7d2cb96 to
e925198
Compare
test have been added and the pre-commit did some cleanup. |
|
sorry for all the noise. I hop this is enough |
|
looking good! I have updated the labels to reflect all your work and thank you!! |
|
@Vaarlion Does this change break those functions on older systemd versions? Or does it now handle both? Can you test the for the old system and for the new system? |
I was confused about changelog, reading that those should only be done when in a release ? I'll look into it 👍
The change allow to work with both the old and new format, and the test are making sure both will work down the line. |
|
Is that changelog good enough ? |
What does this PR do?
This PR fix systemd_service.get_enabled, get_disabled and get_static on newer systemd version
in older systemd version, the output of list-unit-files looked like this
with only 2 fields, The unit name and the enabled state.
On newer version of systemd, they added a new field, the VENDOR_PRESET
Resulting in issue when parsed by this module.
unit_statewould look like'static -'This fix allow any number of field to be split, but only keep the first 2.
What issues does this PR fix or reference?
Fixes: #59526
Previous Behavior
New Behavior
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.