Merge "Fix TypeError with newer version of lshw"

This commit is contained in:
Zuul 2020-05-12 20:26:25 +00:00 committed by Gerrit Code Review
commit cb5769d307
1 changed files with 2 additions and 1 deletions

View File

@ -1003,13 +1003,14 @@ class GenericHardwareManager(HardwareManager):
total = None
LOG.exception(("Cannot fetch total memory size using psutil "
"version %s"), psutil.version_info[0])
sys_dict = None
try:
sys_dict = _get_system_lshw_dict()
except (processutils.ProcessExecutionError, OSError, ValueError) as e:
LOG.warning('Could not get real physical RAM from lshw: %s', e)
physical = None
else:
if isinstance(sys_dict, str):
sys_dict = json.loads(sys_dict)
physical = _calc_memory(sys_dict)
if not physical: