Prevent traceback when /etc/mtab is not available

* get_file_contents returns None when file is not available.
  When /etc/mtab is pointing to /proc/mounts and /proc is not
  mounted, mtab.split will traceback.
This commit is contained in:
Maykel Moya 2013-02-13 02:01:58 +01:00
parent a875b63703
commit 8b27085c34

View file

@ -388,7 +388,7 @@ class LinuxHardware(Hardware):
def get_mount_facts(self):
self.facts['mounts'] = []
mtab = get_file_content('/etc/mtab')
mtab = get_file_content('/etc/mtab', '')
for line in mtab.split('\n'):
if line.startswith('/'):
fields = line.rstrip('\n').split()