From 2ac31e0a141a46fd34d72eb18dcb45f8b7dfe5ba Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 8 Dec 2020 23:24:48 -0500 Subject: [PATCH] Handle issues with state retrieval --- api-daemon/pvcapid/helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api-daemon/pvcapid/helper.py b/api-daemon/pvcapid/helper.py index 9d496381..59a26442 100755 --- a/api-daemon/pvcapid/helper.py +++ b/api-daemon/pvcapid/helper.py @@ -800,7 +800,7 @@ def vm_flush_locks(vm): retflag, retdata = pvc_vm.get_list(zk_conn, None, None, vm, is_fuzzy=False) pvc_common.stopZKConnection(zk_conn) - if retdata['state'] not in ['stop', 'disable']: + if retdata[0].get('state') not in ['stop', 'disable']: return {"message": "VM must be stopped to flush locks"}, 400 zk_conn = pvc_common.startZKConnection(config['coordinators'])