Skip to content

Commit

Permalink
show zone information on (#5014)
Browse files Browse the repository at this point in the history
  • Loading branch information
yugangw-msft authored Nov 30, 2017
1 parent 6fea00b commit f6292e3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/command_modules/azure-cli-vm/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Release History

2.0.19
++++++
* show zone information on `az vm list-skus -otable`
* Update the storage multiapi package reference

2.0.18
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def transform_sku_for_table_output(skus):
order_dict['resourceType'] = k['resourceType']
order_dict['locations'] = str(k['locations']) if len(k['locations']) > 1 else k['locations'][0]
order_dict['name'] = k['name']
if k.get('locationInfo'):
order_dict['zones'] = ','.join(sorted(k['locationInfo'][0].get('zones', [])))
order_dict['size'] = k['size']
order_dict['tier'] = k['tier']
if k['capabilities']:
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2234,6 +2234,16 @@ def test_disk_create_zones(self, resource_group, resource_group_location):
table_output = set(result.output.splitlines()[2].split())
self.assertTrue(set([resource_group, resource_group_location, disk_name, zones]).issubset(table_output))

def test_list_skus_contains_zone_info(self):
from azure_devtools.scenario_tests import LargeResponseBodyProcessor
large_resp_body = next((r for r in self.recording_processors if isinstance(r, LargeResponseBodyProcessor)), None)
if large_resp_body:
large_resp_body._max_response_body = 2048
# we pick eastus2 as it is one of 3 regions so far with zone support
location = 'eastus2'
result = self.cmd('vm list-skus -otable -l {} -otable'.format(location))
self.assertTrue(next(l for l in result.output.splitlines() if '1,2,3' in l).split()[-1] == '1,2,3')


class VMRunCommandScenarioTest(ScenarioTest):
@ResourceGroupPreparer()
Expand Down

0 comments on commit f6292e3

Please sign in to comment.