service - compare version without LooseVersion (#74508)

The distutils module is not shipped with SUNWPython on Solaris.
It's in the SUNWPython-devel package. Do not use LooseVersion.

Fixes: #74488

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2021-05-07 19:52:00 +05:30 committed by GitHub
parent a277644301
commit 4d7dc15d4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- service - compare version without LooseVersion API (https://github.com/ansible/ansible/issues/74488).

View file

@ -1355,8 +1355,8 @@ class SunOSService(Service):
# Support for synchronous restart/refresh is only supported on # Support for synchronous restart/refresh is only supported on
# Oracle Solaris >= 11.2 # Oracle Solaris >= 11.2
for line in open('/etc/release', 'r').readlines(): for line in open('/etc/release', 'r').readlines():
m = re.match(r'\s+Oracle Solaris (\d+\.\d+).*', line.rstrip()) m = re.match(r'\s+Oracle Solaris (\d+)\.(\d+).*', line.rstrip())
if m and LooseVersion(m.groups()[0]) >= LooseVersion('11.2'): if m and m.groups() >= ('11', '2'):
return True return True
def get_service_status(self): def get_service_status(self):