diff --git a/client-cli/cli_lib/vm.py b/client-cli/cli_lib/vm.py index 16a18a26..598c8581 100644 --- a/client-cli/cli_lib/vm.py +++ b/client-cli/cli_lib/vm.py @@ -35,7 +35,7 @@ from cli_lib.common import call_api # def vm_info(config, vm): """ - Get information about VM + Get information about (single) VM API endpoint: GET /api/v1/vm/{vm} API arguments: @@ -44,6 +44,11 @@ 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: + # No exact match; return not found + return False, "VM not found." + else: + return True, response.json()[0] return True, response.json() else: return False, response.json()['message']