Do not fail if /proc/uptime is not present

This can happen in chroot environments that don't have all of /proc
available
pull/12534/head
Toshio Kuratomi 9 years ago
parent ae66d01a33
commit 056a020357

@ -1089,8 +1089,10 @@ class LinuxHardware(Hardware):
self.facts['devices'][diskname] = d self.facts['devices'][diskname] = d
def get_uptime_facts(self): def get_uptime_facts(self):
uptime_seconds_string = get_file_content('/proc/uptime').split(' ')[0] uptime_file_content = get_file_content('/proc/uptime')
self.facts['uptime_seconds'] = int(float(uptime_seconds_string)) if uptime_file_content:
uptime_seconds_string = uptime_file_content.split(' ')[0]
self.facts['uptime_seconds'] = int(float(uptime_seconds_string))
def get_lvm_facts(self): def get_lvm_facts(self):
""" Get LVM Facts if running as root and lvm utils are available """ """ Get LVM Facts if running as root and lvm utils are available """

Loading…
Cancel
Save