From ec01e071d8e5f6c5b6fc73e1e5bbdc806642fb59 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 16 Apr 2015 11:54:50 -0400 Subject: [PATCH] adjusted for the posibolity of lsblk not existing for fact gathering --- lib/ansible/module_utils/facts.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 6b817d4ebcc..136dcb0195d 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -885,13 +885,14 @@ class LinuxHardware(Hardware): size_available = statvfs_result.f_bsize * (statvfs_result.f_bavail) except OSError, e: 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 = out.strip() - else: - uuid = 'NA' + uuid = 'NA' + lsblkPath = module.get_bin_path("lsblk") + if lsblkPath: + 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( {'mount': fields[1],