Check for errors from adb, may not work on all systems.

This commit is contained in:
Tim G 2014-04-01 22:36:19 +10:00
parent 285d4f3fa6
commit c307a73e28

View file

@ -1257,8 +1257,9 @@ class HPUX(Hardware):
#adb output. Unfortunatley /dev/kmem doesn't have world-read, so this only works as root. #adb output. Unfortunatley /dev/kmem doesn't have world-read, so this only works as root.
if os.access("/dev/kmem", os.R_OK): if os.access("/dev/kmem", os.R_OK):
rc, out, err = module.run_command("echo 'phys_mem_pages/D' | adb -k /stand/vmunix /dev/kmem | tail -1 | awk '{print $2}'", use_unsafe_shell=True) rc, out, err = module.run_command("echo 'phys_mem_pages/D' | adb -k /stand/vmunix /dev/kmem | tail -1 | awk '{print $2}'", use_unsafe_shell=True)
data = out if not err:
self.facts['memtotal_mb'] = int(data) / 256 data = out
self.facts['memtotal_mb'] = int(data) / 256
else: else:
rc, out, err = module.run_command("/usr/contrib/bin/machinfo | grep Memory", use_unsafe_shell=True) rc, out, err = module.run_command("/usr/contrib/bin/machinfo | grep Memory", use_unsafe_shell=True)
data = re.search('Memory[\ :=]*([0-9]*).*MB.*',out).groups()[0].strip() data = re.search('Memory[\ :=]*([0-9]*).*MB.*',out).groups()[0].strip()