Avoid errors if stats data is None

This commit is contained in:
Joshua Boniface 2021-07-09 13:13:54 -04:00
parent 2b5dc286ab
commit d1d355a96b
1 changed files with 7 additions and 2 deletions

View File

@ -343,8 +343,13 @@ def getInformationFromXML(zkhandler, uuid):
parsed_xml = getDomainXML(zkhandler, uuid)
stats_data = loads(zkhandler.read(('domain.stats', uuid)))
if stats_data is None:
stats_data = zkhandler.read(('domain.stats', uuid))
if stats_data is not None:
try:
stats_data = loads(stats_data)
except Exception:
stats_data = {}
else:
stats_data = {}
domain_uuid, domain_name, domain_description, domain_memory, domain_vcpu, domain_vcputopo = getDomainMainDetails(parsed_xml)