From b7ccaf04cef15d7f438275f3f299d7e4a97eb5bd Mon Sep 17 00:00:00 2001 From: deflax Date: Sat, 7 Apr 2018 16:38:04 +0300 Subject: [PATCH] statusquery returns status dict so we make the normal return looks the same --- plugin.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/plugin.py b/plugin.py index 274f09c..cbcb737 100644 --- a/plugin.py +++ b/plugin.py @@ -172,16 +172,11 @@ 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': - try: - statusquery = proxobject.nodes(slave_name).qemu(phy_id).status.current.get() - result = str(statusquery['qmpstatus']) - except: - result = 'unknown' + statusquery = proxobject.nodes(slave_name).qemu(phy_id).status.current.get() + result = {'status': str(statusquery['qmpstatus'])} if unit_type == 'lxc': - try: - result = proxobject.nodes(slave_name).lxc(phy_id).status.current.get() - except: - result = 'unknown' + result = proxobject.nodes(slave_name).lxc(phy_id).status.current.get() + return result def start(json):