1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

adjusted for the posibolity of lsblk not existing for fact gathering

This commit is contained in:
Brian Coca 2015-04-16 11:54:50 -04:00
parent 1f7d23fc18
commit ec01e071d8

View file

@ -885,13 +885,14 @@ class LinuxHardware(Hardware):
size_available = statvfs_result.f_bsize * (statvfs_result.f_bavail) size_available = statvfs_result.f_bsize * (statvfs_result.f_bavail)
except OSError, e: except OSError, e:
continue continue
lsblkPath = module.get_bin_path("lsblk")
rc, out, err = module.run_command("%s -ln --output UUID %s" % (lsblkPath, fields[0]), use_unsafe_shell=True)
if rc == 0: uuid = 'NA'
uuid = out.strip() lsblkPath = module.get_bin_path("lsblk")
else: if lsblkPath:
uuid = 'NA' rc, out, err = module.run_command("%s -ln --output UUID %s" % (lsblkPath, fields[0]), use_unsafe_shell=True)
if rc == 0:
uuid = out.strip()
self.facts['mounts'].append( self.facts['mounts'].append(
{'mount': fields[1], {'mount': fields[1],