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

fix for #21729, use VERSION_ID instead of PRETTY_NAME to get release (#21730)

* fix for #21729, use VERSION_ID instead of PRETTY_NAME to get release
This commit is contained in:
Wittmer, Christian 2017-02-27 21:01:02 +01:00 committed by Adrian Likins
parent 19d390135e
commit 52fbfa00f9
2 changed files with 4 additions and 4 deletions

View file

@ -895,7 +895,7 @@ class Distribution(object):
if distribution_version: if distribution_version:
self.facts['distribution_version'] = distribution_version.group(1) self.facts['distribution_version'] = distribution_version.group(1)
if 'open' in data.lower(): if 'open' in data.lower():
release = re.search("^PRETTY_NAME=[^(]+ \(?([^)]+?)\)", line) release = re.search('^VERSION_ID="?[0-9]+\.?([0-9]*)"?', line)
if release: if release:
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:

View file

@ -153,7 +153,7 @@ CODENAME = Malachite
"result":{ "result":{
"distribution": "openSUSE Leap", "distribution": "openSUSE Leap",
"distribution_major_version": "42", "distribution_major_version": "42",
"distribution_release": "x86_64", "distribution_release": "1",
"os_family": "Suse", "os_family": "Suse",
"distribution_version": "42.1", "distribution_version": "42.1",
} }
@ -179,7 +179,7 @@ ID_LIKE="suse"
'platform.dist': ('SuSE', '13.2', 'x86_64'), 'platform.dist': ('SuSE', '13.2', 'x86_64'),
'result': {'distribution': u'openSUSE', 'result': {'distribution': u'openSUSE',
'distribution_major_version': u'13', 'distribution_major_version': u'13',
'distribution_release': u'Harlequin', 'distribution_release': u'2',
'os_family': u'Suse', 'os_family': u'Suse',
'distribution_version': u'13.2'} 'distribution_version': u'13.2'}
}, },
@ -196,7 +196,7 @@ ID_LIKE="suse"
}, },
"name": "openSUSE Tumbleweed 20160917", "name": "openSUSE Tumbleweed 20160917",
"result": { "result": {
"distribution_release": "NA", "distribution_release": "",
"distribution": "openSUSE Tumbleweed", "distribution": "openSUSE Tumbleweed",
"distribution_major_version": "NA", "distribution_major_version": "NA",
"os_family": "Suse", "os_family": "Suse",