Refactor blockdev to use blkid instead of lsblk

This commit is contained in:
Roche, Damien 2017-02-09 10:32:20 +00:00
parent 5ca4d2000d
commit bcb58eba02

View File

@ -160,7 +160,6 @@ def formatted(name, fs_type='ext4', force=False, **kwargs):
return ret return ret
__salt__['disk.format_'](name, fs_type, force=force, **kwargs) __salt__['disk.format_'](name, fs_type, force=force, **kwargs)
current_fs = __salt__['disk.fstype'](name)
# Repeat lsblk check up to 10 times with 3s sleeping between each # Repeat lsblk check up to 10 times with 3s sleeping between each
# to avoid lsblk failing although mkfs has succeeded # to avoid lsblk failing although mkfs has succeeded
@ -193,5 +192,5 @@ def _checkblk(name):
Check if the blk exists and return its fstype if ok Check if the blk exists and return its fstype if ok
''' '''
blk = __salt__['cmd.run']('lsblk -o fstype {0}'.format(name)).splitlines() blk = __salt__['cmd.run']('blkid -o value -s TYPE {0}'.format(name))
return '' if len(blk) == 1 else blk[1] return '' if not blk else blk