From e451426c7ccc23ae9e44be733a68c76d03c711cb Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Mon, 13 Apr 2020 22:56:19 -0400 Subject: [PATCH] Fix minor bugs from change in VM info handling --- client-cli/cli_lib/vm.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client-cli/cli_lib/vm.py b/client-cli/cli_lib/vm.py index 598c8581..8cea0c18 100644 --- a/client-cli/cli_lib/vm.py +++ b/client-cli/cli_lib/vm.py @@ -44,11 +44,15 @@ def vm_info(config, vm): response = call_api(config, 'get', '/vm/{vm}'.format(vm=vm)) if response.status_code == 200: - if len(response.json()) > 1: + if isinstance(response.json(), list) and len(response.json()) > 1: # No exact match; return not found return False, "VM not found." else: - return True, response.json()[0] + if isinstance(response.json(), list): + response = response.json()[0] + else: + response = response.json() + return True, response return True, response.json() else: return False, response.json()['message']