Skip to content

Commit 70e236b

Browse files
committed
fix None value case in returning sku obj
1 parent bfbe122 commit 70e236b

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/azure-cli/azure/cli/command_modules/vm/_vm_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ def is_sku_available(cmd, sku_info, zone):
149149
is_available = False
150150
break
151151
if restriction['type'] == 'Zone' and not (
152-
set(sku_info['location_info'][0].get('zones', [])) - set(restriction['restriction_info'].get('zones', []))):
152+
set(sku_info['location_info'][0].get('zones', []) or []) - set(restriction['restriction_info'].get('zones', []) or [])):
153153
is_restrict_zone = True
154154
if restriction['type'] == 'Location' and (
155-
sku_info['location_info'][0]['location'] in (restriction['restriction_info'].get('locations', []))):
155+
sku_info['location_info'][0]['location'] in (restriction['restriction_info'].get('locations', []) or [])):
156156
is_restrict_location = True
157157

158158
if is_restrict_location or (is_restrict_zone and zone):

src/azure-cli/azure/cli/command_modules/vm/azure_stack/_vm_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ def is_sku_available(cmd, sku_info, zone):
149149
is_available = False
150150
break
151151
if restriction['type'] == 'Zone' and not (
152-
set(sku_info['location_info'][0].get('zones', [])) - set(restriction['restriction_info'].get('zones', []))):
152+
set(sku_info['location_info'][0].get('zones', []) or []) - set(restriction['restriction_info'].get('zones', []) or [])):
153153
is_restrict_zone = True
154154
if restriction['type'] == 'Location' and (
155-
sku_info['location_info'][0]['location'] in (restriction['restriction_info'].get('locations', []))):
155+
sku_info['location_info'][0]['location'] in (restriction['restriction_info'].get('locations', []) or [])):
156156
is_restrict_location = True
157157

158158
if is_restrict_location or (is_restrict_zone and zone):

0 commit comments

Comments
 (0)