Fix TypeError with newer version of lshw
The issue with json output in lshw was fixed in version B.02.19 This patch makes the memory calculation compatible with that version and later versions that are included in recent distributions (e.g. Ubuntu 20.04, Fedora 31) Change-Id: Id5a30028b139c51cae6232cac73a50b917fea233 Story: 2007588 Task: 39527
This commit is contained in:
parent
2738e57f2a
commit
8d210638a8
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user