Merge pull request #27860 from flavio/fix-os-grains-on-suse-and-opensuse

Fix OS related grains on openSUSE and SUSE Linux Enterprise
This commit is contained in:
Mike Place 2015-10-12 09:22:59 -06:00
commit faec838744

View file

@ -1138,7 +1138,7 @@ def os_data():
] = match.groups()[1].rstrip()
if 'lsb_distrib_id' not in grains:
if os.path.isfile('/etc/os-release'):
# Arch ARM Linux
# Arch ARM Linux - SUSE 12+ - openSUSE 13+
with salt.utils.fopen('/etc/os-release') as ifile:
# Imitate lsb-release
for line in ifile:
@ -1159,6 +1159,10 @@ def os_data():
name, value = match.groups()
if name.lower() == 'name':
grains['lsb_distrib_id'] = value.strip()
elif name.lower() == 'version_id':
grains['lsb_distrib_release'] = value
elif name.lower() == 'pretty_name':
grains['lsb_distrib_codename'] = value
elif os.path.isfile('/etc/SuSE-release'):
grains['lsb_distrib_id'] = 'SUSE'
with salt.utils.fopen('/etc/SuSE-release') as fhr: