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

Added distribution facts for OpenSuse

This commit is contained in:
Jonathan Mainguy 2014-12-12 15:51:47 -05:00 committed by Brian Coca
parent b3cd28a5f6
commit 8278626dd0

View file

@ -325,11 +325,15 @@ class Facts(object):
if 'suse' in data.lower(): if 'suse' in data.lower():
if path == '/etc/os-release': if path == '/etc/os-release':
release = re.search("PRETTY_NAME=[^(]+ \(?([^)]+?)\)", data) release = re.search("PRETTY_NAME=[^(]+ \(?([^)]+?)\)", data)
distdata = get_file_content(path).split('\n')[0]
self.facts['distribution'] = distdata.split('=')[1]
if release: if release:
self.facts['distribution_release'] = release.groups()[0] self.facts['distribution_release'] = release.groups()[0]
break break
elif path == '/etc/SuSE-release': elif path == '/etc/SuSE-release':
data = data.splitlines() data = data.splitlines()
distdata = get_file_content(path).split('\n')[0]
self.facts['distribution'] = distdata.split()[0]
for line in data: for line in data:
release = re.search('CODENAME *= *([^\n]+)', line) release = re.search('CODENAME *= *([^\n]+)', line)
if release: if release: