mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
os.uname is not available on py2 windows
This commit is contained in:
parent
062fe7cccf
commit
b7a37ecf11
1 changed files with 13 additions and 3 deletions
|
@ -82,6 +82,10 @@ if salt.utils.platform.is_windows():
|
|||
'will be missing'
|
||||
)
|
||||
|
||||
HAS_UNAME = True
|
||||
if not hasattr(os, 'uname'):
|
||||
HAS_UNAME = False
|
||||
|
||||
_INTERFACES = {}
|
||||
|
||||
|
||||
|
@ -689,7 +693,7 @@ def _virtual(osdata):
|
|||
|
||||
# Quick backout for BrandZ (Solaris LX Branded zones)
|
||||
# Don't waste time trying other commands to detect the virtual grain
|
||||
if osdata['kernel'] == 'Linux' and 'BrandZ virtual linux' in os.uname():
|
||||
if HAS_UNAME and osdata['kernel'] == 'Linux' and 'BrandZ virtual linux' in os.uname():
|
||||
grains['virtual'] = 'zone'
|
||||
return grains
|
||||
|
||||
|
@ -1780,7 +1784,10 @@ def os_data():
|
|||
elif grains['kernel'] == 'SunOS':
|
||||
if salt.utils.platform.is_smartos():
|
||||
# See https://github.com/joyent/smartos-live/issues/224
|
||||
uname_v = os.uname()[3] # format: joyent_20161101T004406Z
|
||||
if HAS_UNAME:
|
||||
uname_v = os.uname()[3] # format: joyent_20161101T004406Z
|
||||
else:
|
||||
uname_v = os.name
|
||||
uname_v = uname_v[uname_v.index('_')+1:]
|
||||
grains['os'] = grains['osfullname'] = 'SmartOS'
|
||||
# store a parsed version of YYYY.MM.DD as osrelease
|
||||
|
@ -1809,7 +1816,10 @@ def os_data():
|
|||
else:
|
||||
if development is not None:
|
||||
osname = ' '.join((osname, development))
|
||||
uname_v = os.uname()[3]
|
||||
if HAS_UNAME:
|
||||
uname_v = os.uname()[3]
|
||||
else:
|
||||
uname_v = os.name
|
||||
grains['os'] = grains['osfullname'] = osname
|
||||
if osname in ['Oracle Solaris'] and uname_v.startswith(osmajorrelease):
|
||||
# Oracla Solars 11 and up have minor version in uname
|
||||
|
|
Loading…
Add table
Reference in a new issue