Fix minor bugs from change in VM info handling

This commit is contained in:
Joshua Boniface 2020-04-13 22:56:19 -04:00
parent 611e0edd80
commit e451426c7c
1 changed files with 6 additions and 2 deletions

View File

@ -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']