mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
facts should now not be overriten with NA option unless they are NA
this way we don't need a break per distro that matched already with the python default functions
This commit is contained in:
parent
4098e8283e
commit
f174682e19
1 changed files with 12 additions and 9 deletions
|
@ -417,13 +417,13 @@ class Facts(object):
|
|||
self.facts['distribution_version'] = self.facts['distribution_version'] + '.' + release.group(1)
|
||||
elif name == 'Debian':
|
||||
data = get_file_content(path)
|
||||
if 'Ubuntu' in data:
|
||||
break # Ubuntu gets correct info from python functions
|
||||
elif 'Debian' in data or 'Raspbian' in data:
|
||||
if 'Debian' in data or 'Raspbian' in data:
|
||||
release = re.search("PRETTY_NAME=[^(]+ \(?([^)]+?)\)", data)
|
||||
if release:
|
||||
self.facts['distribution_release'] = release.groups()[0]
|
||||
break
|
||||
elif 'Ubuntu' in data:
|
||||
break # Ubuntu gets correct info from python functions
|
||||
elif name == 'Mandriva':
|
||||
data = get_file_content(path)
|
||||
if 'Mandriva' in data:
|
||||
|
@ -438,12 +438,15 @@ class Facts(object):
|
|||
elif name == 'NA':
|
||||
data = get_file_content(path)
|
||||
for line in data.splitlines():
|
||||
distribution = re.search("^NAME=(.*)", line)
|
||||
if distribution:
|
||||
self.facts['distribution'] = distribution.group(1).strip('"')
|
||||
version = re.search("^VERSION=(.*)", line)
|
||||
if version:
|
||||
self.facts['distribution_version'] = version.group(1).strip('"')
|
||||
if self.facts['distribution'] == 'NA':
|
||||
distribution = re.search("^NAME=(.*)", line)
|
||||
if distribution:
|
||||
self.facts['distribution'] = distribution.group(1).strip('"')
|
||||
if self.facts['distribution_version'] == 'NA':
|
||||
version = re.search("^VERSION=(.*)", line)
|
||||
if version:
|
||||
self.facts['distribution_version'] = version.group(1).strip('"')
|
||||
|
||||
if self.facts['distribution'].lower() == 'coreos':
|
||||
data = get_file_content('/etc/coreos/update.conf')
|
||||
release = re.search("^GROUP=(.*)", data)
|
||||
|
|
Loading…
Reference in a new issue