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

service.enabled (and possibly others) can't find a service if ".service" is appended to service name #26358

Closed
MoonSweep opened this issue Aug 16, 2015 · 5 comments
Labels
Bug broken, incorrect, or confusing behavior Execution-Module help-wanted Community help is needed to resolve this P2 Priority 2 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around stale
Milestone

Comments

@MoonSweep
Copy link

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.

@jfindlay jfindlay added Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around help-wanted Community help is needed to resolve this P2 Priority 2 Platform Relates to OS, containers, platform-based utilities like FS, system based apps Execution-Module labels Aug 17, 2015
@jfindlay jfindlay added this to the Approved milestone Aug 17, 2015
@jfindlay
Copy link
Contributor

@MoonSweep, thanks for the report.

@abednarik
Copy link
Contributor

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

@MoonSweep
Copy link
Author

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

@abednarik
Copy link
Contributor

Ok thanks.

Let wait for Salt Team to see if we should backport this to 2015.5 or not.

Cheers.

@stale
Copy link

stale bot commented Mar 5, 2018

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.

@stale stale bot added the stale label Mar 5, 2018
@stale stale bot closed this as completed Mar 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Execution-Module help-wanted Community help is needed to resolve this P2 Priority 2 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around stale
Projects
None yet
Development

No branches or pull requests

3 participants