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.
This commit is contained in:
Logos01 2014-04-28 14:37:23 -07:00
parent 1576e8d611
commit 424ee36e05

View file

@ -303,7 +303,9 @@ class Facts(object):
self.facts['distribution_release'] = ora_prefix + data
elif name == 'SuSE':
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':
data = get_file_content(path).split('\n')[0]
release = re.search("PRETTY_NAME.+ \(?([^ ]+?)\)?\"", data)