summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhijeet Kasurde <akasurde@redhat.com>2021-05-17 14:37:11 +0530
committerGitHub <noreply@github.com>2021-05-17 04:07:11 -0500
commit66a9ea2f23d673a92c007a6f7ef6c793b407dd10 (patch)
treec8ea510c0541b68b23bac5622806d753cf8c851d
parent162973d1a7a09932408a2744eb5f770b9fc5afb0 (diff)
downloadansible-66a9ea2f23d673a92c007a6f7ef6c793b407dd10.tar.gz
[bp-2.11] service - compare version without LooseVersion (#74618)
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 59cd7e8113..056183be05 100644
--- a/lib/ansible/modules/service.py
+++ b/lib/ansible/modules/service.py
@@ -1355,8 +1355,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):