mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
The '-s' option for restart/refresh is only supported on Oracle Solaris >= 11
Closes #20102
This commit is contained in:
parent
c7739be960
commit
a412be32b5
1 changed files with 15 additions and 2 deletions
|
@ -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…
Reference in a new issue