summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhijeet Kasurde <akasurde@redhat.com>2021-05-17 10:56:32 +0530
committerGitHub <noreply@github.com>2021-05-17 00:26:32 -0500
commita6a2af781439ee95676a7555754eec3c722ee4c5 (patch)
treecd50b587c2f0d0a50bffb3bb12051d06b3da1eb5
parent8c95db4b8d81ce412cab0757f6a17a7143852f84 (diff)
downloadansible-a6a2af781439ee95676a7555754eec3c722ee4c5.tar.gz
[bp-2.10] service - compare version without LooseVersion (#74619)
The distutils module is not shipped with SUNWPython on Solaris. It's in the SUNWPython-devel package. Do not use LooseVersion. Fixes: #74488 (cherry picked from commit 4d7dc15d4e1e214e5091abc554eddb6974b72830) Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
-rw-r--r--changelogs/fragments/74488_solaris_looseversion.yml2
-rw-r--r--lib/ansible/modules/service.py4
2 files changed, 4 insertions, 2 deletions
diff --git a/changelogs/fragments/74488_solaris_looseversion.yml b/changelogs/fragments/74488_solaris_looseversion.yml
new file mode 100644
index 0000000000..82eb650197
--- /dev/null
+++ b/changelogs/fragments/74488_solaris_looseversion.yml
@@ -0,0 +1,2 @@
+bugfixes:
+- service - compare version without LooseVersion API (https://github.com/ansible/ansible/issues/74488).
diff --git a/lib/ansible/modules/service.py b/lib/ansible/modules/service.py
index f4eb709735..3a0953a43f 100644
--- a/lib/ansible/modules/service.py
+++ b/lib/ansible/modules/service.py
@@ -1356,8 +1356,8 @@ class SunOSService(Service):
# Support for synchronous restart/refresh is only supported on
# Oracle Solaris >= 11.2
for line in open('/etc/release', 'r').readlines():
- m = re.match(r'\s+Oracle Solaris (\d+\.\d+).*', line.rstrip())
- if m and m.groups()[0] >= 11.2:
+ m = re.match(r'\s+Oracle Solaris (\d+)\.(\d+).*', line.rstrip())
+ if m and m.groups() >= ('11', '2'):
return True
def get_service_status(self):