The '-s' option for restart/refresh is only supported on Oracle Solaris >= 11

Closes #20102
pull/20658/head
Jasper Lievisse Adriaanse 8 years ago committed by Brian Coca
parent c7739be960
commit a412be32b5

@ -1303,6 +1303,19 @@ class SunOSService(Service):
if not self.svcadm_cmd:
self.module.fail_json(msg='unable to find svcadm binary')
if self.svcadm_supports_sync():
self.svcadm_sync = '-s'
else:
self.svcadm_sync = ''
def svcadm_supports_sync(self):
# Support for synchronous restart/refresh is only supported on
# Oracle Solaris >= 11.
for line in open('/etc/release', 'r').readlines():
m = re.match('\s+Oracle Solaris (\d+\.\d+).*', line.rstrip())
if m and m.groups()[0] > 10:
return True
def get_service_status(self):
status = self.get_sunos_svcs_status()
# Only 'online' is considered properly running. Everything else is off
@ -1394,9 +1407,9 @@ class SunOSService(Service):
elif self.action == 'stop':
subcmd = "disable -st"
elif self.action == 'reload':
subcmd = "refresh -s"
subcmd = "refresh %s" % (self.svcadm_sync)
elif self.action == 'restart' and status == 'online':
subcmd = "restart -s"
subcmd = "restart %s" % (self.svcadm_sync)
elif self.action == 'restart' and status != 'online':
subcmd = "enable -rst"

Loading…
Cancel
Save