From 2d14fabe62542a5b4eee2a46aae3891b67a70130 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 19 Dec 2019 11:30:13 -0500 Subject: [PATCH] Don't throw exception while defining new VM This would throw an exception since we tried to find the current host of a VM that did not exist yet. If this happens, just get None. --- client-common/common.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client-common/common.py b/client-common/common.py index 7bfba3b3..182f3d96 100644 --- a/client-common/common.py +++ b/client-common/common.py @@ -334,7 +334,10 @@ def findTargetNode(zk_conn, dom_uuid): def getNodes(zk_conn, node_limit, dom_uuid): valid_node_list = [] full_node_list = zkhandler.listchildren(zk_conn, '/nodes') - current_node = zkhandler.readdata(zk_conn, '/domains/{}/node'.format(dom_uuid)) + try: + current_node = zkhandler.readdata(zk_conn, '/domains/{}/node'.format(dom_uuid)) + except kazoo.exceptions.NoNodeError: + current_node = None for node in full_node_list: if node_limit and node not in node_limit: