mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Fix OS detection for OpenSolaris
This fixes the OS detection for OpenSolaris, allowing it to be properly recognized and for 'os' and 'osrelease' grains to be set correctly.
This commit is contained in:
parent
8086ddba21
commit
da24dc29a3
@ -746,6 +746,9 @@ _OS_FAMILY_MAP = {
|
||||
'Solaris': 'Solaris',
|
||||
'SmartOS': 'Solaris',
|
||||
'OpenIndiana Development': 'Solaris',
|
||||
'OpenIndiana': 'Solaris',
|
||||
'OpenSolaris Development': 'Solaris',
|
||||
'OpenSolaris': 'Solaris',
|
||||
'Arch ARM': 'Arch',
|
||||
'ALT': 'RedHat',
|
||||
'Trisquel': 'Debian',
|
||||
@ -919,16 +922,20 @@ def os_data():
|
||||
with salt.utils.fopen('/etc/release', 'r') as fp_:
|
||||
rel_data = fp_.read()
|
||||
try:
|
||||
release_re = r'(Solaris|OpenIndiana(?: Development)?)' \
|
||||
r'\s+(\d+ \d+\/\d+|oi_\S+)?'
|
||||
osname, osrelease = re.search(release_re,
|
||||
rel_data).groups()
|
||||
release_re = re.compile(
|
||||
r'((?:Open)Solaris|OpenIndiana)( Development)?'
|
||||
r'\s+(\d+ \d+\/\d+|oi_\S+|snv_\S+)?'
|
||||
)
|
||||
osname, development, osrelease = \
|
||||
release_re.search(rel_data).groups()
|
||||
except AttributeError:
|
||||
# Set a blank osrelease grain and fallback to 'Solaris'
|
||||
# as the 'os' grain.
|
||||
grains['os'] = grains['osfullname'] = 'Solaris'
|
||||
grains['osrelease'] = ''
|
||||
else:
|
||||
if development is not None:
|
||||
osname = ''.join((osname, development))
|
||||
grains['os'] = grains['osfullname'] = osname
|
||||
grains['osrelease'] = osrelease
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user