"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "salt/grains/disks.py" between
salt-2019.2.0.tar.gz and salt-2019.2.1.tar.gz

About: SaltStack is a systems management software for data center automation, cloud orchestration, server provisioning, configuration management and more. Community version.

disks.py  (salt-2019.2.0):disks.py  (salt-2019.2.1)
skipping to change at line 153 skipping to change at line 153
) )
except IOError: except IOError:
pass pass
return ret return ret
def _windows_disks(): def _windows_disks():
wmic = salt.utils.path.which('wmic') wmic = salt.utils.path.which('wmic')
namespace = r'\\root\microsoft\windows\storage' namespace = r'\\root\microsoft\windows\storage'
path = 'MSFT_PhysicalDisk' path = 'MSFT_PhysicalDisk'
where = '(MediaType=3 or MediaType=4)'
get = 'DeviceID,MediaType' get = 'DeviceID,MediaType'
ret = {'disks': [], 'SSDs': []} ret = {'disks': [], 'SSDs': []}
cmdret = __salt__['cmd.run_all']( cmdret = __salt__['cmd.run_all'](
'{0} /namespace:{1} path {2} where {3} get {4} /format:table'.format( '{0} /namespace:{1} path {2} get {3} /format:table'.format(
wmic, namespace, path, where, get)) wmic, namespace, path, get))
if cmdret['retcode'] != 0: if cmdret['retcode'] != 0:
log.trace('Disk grain does not support this version of Windows') log.trace('Disk grain does not support this version of Windows')
else: else:
for line in cmdret['stdout'].splitlines(): for line in cmdret['stdout'].splitlines():
info = line.split() info = line.split()
if len(info) != 2 or not info[0].isdigit() or not info[1].isdigit(): if len(info) != 2 or not info[0].isdigit() or not info[1].isdigit():
continue continue
device = r'\\.\PhysicalDrive{0}'.format(info[0]) device = r'\\.\PhysicalDrive{0}'.format(info[0])
mediatype = info[1] mediatype = info[1]
if mediatype == '3': if mediatype == '3':
log.trace('Device %s reports itself as an HDD', device) log.trace('Device %s reports itself as an HDD', device)
ret['disks'].append(device) ret['disks'].append(device)
elif mediatype == '4': elif mediatype == '4':
log.trace('Device %s reports itself as an SSD', device) log.trace('Device %s reports itself as an SSD', device)
ret['SSDs'].append(device) ret['SSDs'].append(device)
ret['disks'].append(device)
elif mediatype == '5':
log.trace('Device %s reports itself as an SCM', device)
ret['disks'].append(device)
else: else:
log.trace( log.trace('Device %s reports itself as Unspecified', device)
'Unable to identify device %s as an SSD or HDD. It does ' ret['disks'].append(device)
'not report 3 or 4', device
)
return ret return ret
 End of changes. 4 change blocks. 
7 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)