From 6c8878371761652d622230b29de3830015501391 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Wed, 4 Jan 2017 14:46:13 -0800 Subject: [PATCH] Add a table transform for acs show to match acs list. --- .../azure/cli/command_modules/vm/commands.py | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/commands.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/commands.py index 1abe2e07af2..ec290b5b98e 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/commands.py +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/commands.py @@ -86,16 +86,20 @@ # ACS +def transform_acs(r): + orchestratorType = 'Unknown' + orchestratorProfile = r.get('orchestratorProfile') + if orchestratorProfile: + orchestratorType = orchestratorProfile.get('orchestratorType') + res = OrderedDict([('Name', r['name']), ('ResourceGroup', r['resourceGroup']), \ + ('Orchestrator', orchestratorType), ('Location', r['location']), \ + ('ProvisioningState', r['provisioningState'])]) + return res + def transform_acs_list(result): transformed = [] for r in result: - orchestratorType = 'Unknown' - orchestratorProfile = r.get('orchestratorProfile') - if orchestratorProfile: - orchestratorType = orchestratorProfile.get('orchestratorType') - res = OrderedDict([('Name', r['name']), ('ResourceGroup', r['resourceGroup']), \ - ('Orchestrator', orchestratorType), ('Location', r['location']), \ - ('ProvisioningState', r['provisioningState'])]) + res = transform_acs(r) transformed.append(res) return transformed @@ -107,7 +111,7 @@ def transform_acs_list(result): ###### op_var = 'container_services_operations' op_class = 'ContainerServicesOperations' -cli_command(__name__, 'acs show', mgmt_path.format(op_var, op_class, 'get'), cf_acs) +cli_command(__name__, 'acs show', mgmt_path.format(op_var, op_class, 'get'), cf_acs, table_transformer=transform_acs) cli_command(__name__, 'acs list', custom_path.format('list_container_services'), cf_acs, table_transformer=transform_acs_list) cli_command(__name__, 'acs delete', mgmt_path.format(op_var, op_class, 'delete'), cf_acs) cli_command(__name__, 'acs scale', custom_path.format('update_acs'))