From d1d355a96bc44d0a80e0646576aae0da50247ede Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 9 Jul 2021 13:13:54 -0400 Subject: [PATCH] Avoid errors if stats data is None --- daemon-common/common.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/daemon-common/common.py b/daemon-common/common.py index c29b20a2..f7e59a14 100644 --- a/daemon-common/common.py +++ b/daemon-common/common.py @@ -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)