1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

last ditch debian release data (#20571)

fixes #10445
This commit is contained in:
Brian Coca 2017-02-01 13:15:02 -05:00 committed by GitHub
parent 91b363ea9e
commit 86db15b105

View file

@ -931,11 +931,18 @@ class Distribution(object):
release = re.search("PRETTY_NAME=[^(]+ \(?([^)]+?)\)", data) release = re.search("PRETTY_NAME=[^(]+ \(?([^)]+?)\)", data)
if release: if release:
self.facts['distribution_release'] = release.groups()[0] self.facts['distribution_release'] = release.groups()[0]
# Last resort: try to find release from tzdata as either lsb is missing or this is very old debian
if self.facts['distribution_release'] == 'NA' and 'Debian' in data:
dpkg_cmd = self.module.get_bin_path('dpkg')
if dpkg_cmd:
cmd = "%s --status tzdata|grep Provides|cut -f2 -d'-'" % dpkg_cmd
rc, out, err = self.module.run_command(cmd)
if rc == 0:
self.facts['distribution_release'] = out.strip()
elif 'Ubuntu' in data: elif 'Ubuntu' in data:
self.facts['distribution'] = 'Ubuntu' self.facts['distribution'] = 'Ubuntu'
pass # Ubuntu gets correct info from python functions # nothing else to do, Ubuntu gets correct info from python functions
else:
return False # TODO: remove if tested without this
def get_distribution_Mandriva(self, name, data, path): def get_distribution_Mandriva(self, name, data, path):
if 'Mandriva' in data: if 'Mandriva' in data: