mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #14552 from kilburn/lsblk-dedup
Avoid duplicate /bin/lsblk calls in the setup module.
This commit is contained in:
commit
81368d8119
1 changed files with 11 additions and 6 deletions
|
@ -1037,6 +1037,7 @@ class LinuxHardware(Hardware):
|
|||
|
||||
@timeout(10)
|
||||
def get_mount_facts(self):
|
||||
uuids = dict()
|
||||
self.facts['mounts'] = []
|
||||
mtab = get_file_content('/etc/mtab', '')
|
||||
for line in mtab.split('\n'):
|
||||
|
@ -1052,6 +1053,9 @@ class LinuxHardware(Hardware):
|
|||
except OSError:
|
||||
continue
|
||||
|
||||
if fields[0] in uuids:
|
||||
uuid = uuids[fields[0]]
|
||||
else:
|
||||
uuid = 'NA'
|
||||
lsblkPath = module.get_bin_path("lsblk")
|
||||
if lsblkPath:
|
||||
|
@ -1059,6 +1063,7 @@ class LinuxHardware(Hardware):
|
|||
|
||||
if rc == 0:
|
||||
uuid = out.strip()
|
||||
uuids[fields[0]] = uuid
|
||||
|
||||
self.facts['mounts'].append(
|
||||
{'mount': fields[1],
|
||||
|
|
Loading…
Reference in a new issue