From 9bbc449889c5c659ee93c9cd3cbb924dd0e53baa Mon Sep 17 00:00:00 2001 From: deflax Date: Sat, 7 Apr 2018 16:29:45 +0300 Subject: [PATCH] add unknown status to the status url --- plugin.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugin.py b/plugin.py index 35aea5d..274f09c 100644 --- a/plugin.py +++ b/plugin.py @@ -172,10 +172,16 @@ def status(json): #slave_name = proxobject.cluster.status.get()[0]['name'] ioconfig.logger.info('%s[%s]> status of %s %s (%s)' % (vm_owner, slave_name, unit_type, phy_id, vm_host)) if unit_type == 'kvm': - statusquery = proxobject.nodes(slave_name).qemu(phy_id).status.current.get() - result = str(statusquery['qmpstatus']) + try: + statusquery = proxobject.nodes(slave_name).qemu(phy_id).status.current.get() + result = str(statusquery['qmpstatus']) + except: + result = 'unknown' if unit_type == 'lxc': - result = proxobject.nodes(slave_name).lxc(phy_id).status.current.get() + try: + result = proxobject.nodes(slave_name).lxc(phy_id).status.current.get() + except: + result = 'unknown' return result def start(json):