Commit f174682e by Brian Coca

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
parent 4098e828
...@@ -417,13 +417,13 @@ class Facts(object): ...@@ -417,13 +417,13 @@ class Facts(object):
self.facts['distribution_version'] = self.facts['distribution_version'] + '.' + release.group(1) self.facts['distribution_version'] = self.facts['distribution_version'] + '.' + release.group(1)
elif name == 'Debian': elif name == 'Debian':
data = get_file_content(path) data = get_file_content(path)
if 'Ubuntu' in data: if 'Debian' in data or 'Raspbian' in data:
break # Ubuntu gets correct info from python functions
elif 'Debian' in data or 'Raspbian' in data:
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]
break break
elif 'Ubuntu' in data:
break # Ubuntu gets correct info from python functions
elif name == 'Mandriva': elif name == 'Mandriva':
data = get_file_content(path) data = get_file_content(path)
if 'Mandriva' in data: if 'Mandriva' in data:
...@@ -438,12 +438,15 @@ class Facts(object): ...@@ -438,12 +438,15 @@ class Facts(object):
elif name == 'NA': elif name == 'NA':
data = get_file_content(path) data = get_file_content(path)
for line in data.splitlines(): for line in data.splitlines():
if self.facts['distribution'] == 'NA':
distribution = re.search("^NAME=(.*)", line) distribution = re.search("^NAME=(.*)", line)
if distribution: if distribution:
self.facts['distribution'] = distribution.group(1).strip('"') self.facts['distribution'] = distribution.group(1).strip('"')
if self.facts['distribution_version'] == 'NA':
version = re.search("^VERSION=(.*)", line) version = re.search("^VERSION=(.*)", line)
if version: if version:
self.facts['distribution_version'] = version.group(1).strip('"') self.facts['distribution_version'] = version.group(1).strip('"')
if self.facts['distribution'].lower() == 'coreos': if self.facts['distribution'].lower() == 'coreos':
data = get_file_content('/etc/coreos/update.conf') data = get_file_content('/etc/coreos/update.conf')
release = re.search("^GROUP=(.*)", data) release = re.search("^GROUP=(.*)", data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment