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

fix tests for SLES and CoreOS

* include #15230
This commit is contained in:
Robin Roth 2016-04-14 19:01:24 +02:00 committed by Robin Roth
parent 3c883d8a6d
commit 2b104fe6ad
2 changed files with 20 additions and 18 deletions

View file

@ -126,8 +126,8 @@ class Facts(object):
('/etc/alpine-release', 'Alpine'), ('/etc/alpine-release', 'Alpine'),
('/etc/release', 'Solaris'), ('/etc/release', 'Solaris'),
('/etc/arch-release', 'Archlinux'), ('/etc/arch-release', 'Archlinux'),
('/etc/SuSE-release', 'SuSE'),
('/etc/os-release', 'SuSE'), ('/etc/os-release', 'SuSE'),
('/etc/SuSE-release', 'SuSE'),
('/etc/gentoo-release', 'Gentoo'), ('/etc/gentoo-release', 'Gentoo'),
('/etc/os-release', 'Debian'), ('/etc/os-release', 'Debian'),
('/etc/lsb-release', 'Mandriva'), ('/etc/lsb-release', 'Mandriva'),
@ -459,7 +459,7 @@ class Facts(object):
self.facts['distribution_release'] = release.groups()[0] self.facts['distribution_release'] = release.groups()[0]
elif 'enterprise' in data.lower() and 'VERSION_ID' in line: elif 'enterprise' in data.lower() and 'VERSION_ID' in line:
release = re.search('^VERSION_ID="?[0-9]+\.?([0-9]*)"?', line) # SLES doesn't got funny release names release = re.search('^VERSION_ID="?[0-9]+\.?([0-9]*)"?', line) # SLES doesn't got funny release names
if release.group(1): if release and release.group(1):
release = release.group(1) release = release.group(1)
else: else:
release = "0" # no minor number, so it is the first release release = "0" # no minor number, so it is the first release
@ -521,9 +521,11 @@ class Facts(object):
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')
if data:
release = re.search("^GROUP=(.*)", data) release = re.search("^GROUP=(.*)", data)
if release: if release:
self.facts['distribution_release'] = release.group(1).strip('"') self.facts['distribution_release'] = release.group(1).strip('"')
else: else:
self.facts['distribution'] = name self.facts['distribution'] = name
machine_id = get_file_content("/var/lib/dbus/machine-id") or get_file_content("/etc/machine-id") machine_id = get_file_content("/var/lib/dbus/machine-id") or get_file_content("/etc/machine-id")