Service restart on Solaris 10 broken #20102

Open
photoninger opened this Issue Jan 10, 2017 · 1 comment

Projects

None yet

5 participants

@photoninger
ISSUE TYPE
  • Bug Report
COMPONENT NAME

service module

ANSIBLE VERSION
ansible 2.2.1.0 (detached HEAD d8c9b8d347) last updated 2017/01/10 10:52:47 (GMT +200)
  lib/ansible/modules/core: (detached HEAD a9d844c089) last updated 2017/01/10 11:01:04 (GMT +200)
  lib/ansible/modules/extras: (detached HEAD 19d20ca1a0) last updated 2017/01/10 11:01:04 (GMT +200)
OS / ENVIRONMENT

Running from macOS 10.12
Managing Solaris 10 10/09 s10s_u8wos_08a SPARC

SUMMARY

Service states restarted and reloaded raise an error

STEPS TO REPRODUCE
ansible solaris10-host -m service -a "state=restarted name=system-log" -u root

EXPECTED RESULTS

Service system-log is restarted

ACTUAL RESULTS
solaris10-host | FAILED! => {
    "changed": false, 
    "failed": true, 
    "msg": "svcadm: Pattern '-s' doesn't match any instances\n"
}

The changes introduced with ansible/ansible-modules-core#5406 broke compability to Solaris 10.
On Solaris 10 there is no option "-s" for subcommands restart and refresh:
Only the subcommands enable and disable support option "-s".
man page Solaris 10: https://docs.oracle.com/cd/E23823_01/html/816-5166/svcadm-1m.html
man page Solaris 11: https://docs.oracle.com/cd/E53394_01/html/E54764/svcadm-1m.html

So for Solaris 10 this option should be omitted for restart and refresh.

We need something like

if distribution_version == 10:
  option = ""
else:
  option = " -s"
[...]
 elif self.action == 'reload':
            subcmd = "refresh" + option
 elif self.action == 'restart' and status == 'online':
            subcmd = "restart" + option

I don't know if the service module can get distribution_version from facts.py...

@bcoca bcoca was assigned by abadger Jan 11, 2017
@abadger abadger removed the needs_triage label Jan 11, 2017
@precurse

FWIW this is also affecting SmartOS instances:

fatal: [haproxy]: FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "arguments": "", 
            "enabled": null, 
            "name": "rsyslog", 
            "pattern": null, 
            "runlevel": "default", 
            "sleep": null, 
            "state": "reloaded"
        }
    }, 
    "msg": "svcadm: Pattern '-s' doesn't match any instances\n"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment