Commit 424ee36e by Logos01

Enable facts module on older SuSE systems

Modified logic of distribution_release for SuSE to retain the last discovered key/value pair's value in /etc/SuSE-release that contains a '=' character.
parent 1576e8d6
...@@ -303,7 +303,9 @@ class Facts(object): ...@@ -303,7 +303,9 @@ class Facts(object):
self.facts['distribution_release'] = ora_prefix + data self.facts['distribution_release'] = ora_prefix + data
elif name == 'SuSE': elif name == 'SuSE':
data = get_file_content(path).splitlines() data = get_file_content(path).splitlines()
self.facts['distribution_release'] = data[2].split('=')[1].strip() for line in data:
if '=' in line:
self.facts['distribution_release'] = line.split('=')[1].strip()
elif name == 'Debian': elif name == 'Debian':
data = get_file_content(path).split('\n')[0] data = get_file_content(path).split('\n')[0]
release = re.search("PRETTY_NAME.+ \(?([^ ]+?)\)?\"", data) release = re.search("PRETTY_NAME.+ \(?([^ ]+?)\)?\"", 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