-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Better handling of systemd parametrised and other special units not listed by list-unit-files. #11921
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
This allows to query status, start, stop, restart and list units that are not actually provided by unit files. Such units cannot be enabled/disabled and that's why those actions still prefer the "list-unit-files" output over "list-units". Units that couldn't be handled otherwise include for example mount units and sysvinit compatibility units such as those present on debian systems. The output of a "service.running ssh" state on a debian wheezy target is: ID: ssh Function: service.running Result: False Comment: The named service ssh is not available Changes: after this patch: ID: ssh Function: service.running Result: True Comment: The service ssh is already running Changes:
Test Failed. If the failures are unrelated to your code, don't stress, a core developer will know these apart. |
This may have some bearing on #8444 too. Nice work. |
Yes, this will partially fix #8444, meaning that a service like Enabling such services will require special handling of service names containg |
@mtorromeo Sounds great. Thanks again for your work here. Looking forward to your additional PRs to improve systemd support! |
This makes the systemd.get_all function return the combined output of list-units and list-unit-files and the systemd.available function will also check for the base unit name stripped of the user parameter (e.g. dhcpcd@eth0 will be considered available if [email protected] exists)
I decided to go ahead and implement here the missing pieces to handle parametrised units in the systemd state. With this a state such as the following will work as expected:
|
Test Failed. If the failures are unrelated to your code, don't stress, a core developer will know these apart. |
Better handling of systemd parametrised and other special units not listed by list-unit-files.
This allows to query status, start, stop, restart and list units that are not actually provided by unit files. Such units cannot be enabled/disabled and that's why those actions still prefer the "list-unit-files" output over "list-units".
Units that couldn't be handled otherwise include for example mount units and sysvinit compatibility units such as those present on debian systems.
The output of a "service.running ssh" state on a debian wheezy target is:
after this patch: