service.enabled (and possibly others) can't find a service if ".service" is appended to service name
Hi,
In systemd, the true name for a service ends with ".service", the form without this suffix being merely a shortcut. SaltStack doesn't understand this:
enable-systemd-timesyncd:
service.enabled:
- name: systemd-timesyncd.service
...results in:
ID: enable-systemd-timesyncd
Function: service.enabled
Name: systemd-timesyncd.service
Result: False
Comment: The named service systemd-timesyncd.service is not available
Started: 15:33:45.193092
Duration: 157.018 ms
Changes:
If I remove ".service", it works:
enable-systemd-timesyncd:
service.enabled:
- name: systemd-timesyncd
...results in:
ID: enable-systemd-timesyncd
Function: service.enabled
Name: systemd-timesyncd
Result: True
Comment: Service systemd-timesyncd is already enabled, and is in the desired state
Started: 15:31:11.620675
Duration: 171.07 ms
Changes:
The form ending in ".service" being the true form, and the one without the suffix being a shortcut (emphasized by the bash completion for systemctl command), I think SaltStack should understand both and not give an error if ".service" is added to a service name.
Moreover, other suffices work as expected. For example, to have /tmp mounted in a ramdisk:
enable-ramtmp:
service.enabled:
- name: tmp.mount
...results in:
ID: enable-ramtmp
Function: service.enabled
Name: tmp.mount
Result: True
Comment: Service tmp.mount is already enabled, and is in the desired state
Started: 15:31:11.799996
Duration: 170.061 ms
Changes:
Thanks.
@MoonSweep, thanks for the report.
Hi @MoonSweep
Which version of salt are you running? I made a code review and prefix should be handled by salt. Please run
salt --versions-report
Thanks
It works now.
Current versions: Master: 2015.5.3 Minion: 2015.8.3
Previous versions (on the date of the bug report, according to APT logs): Master: 2015.5.3 Minion: 2015.5.3
Ok thanks.
Let wait for Salt Team to see if we should backport this to 2015.5 or not.
Cheers.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.