-
Notifications
You must be signed in to change notification settings - Fork 3.4k
{Network} az network: Migrate commands calling Compute module to aaz-based implementation #32949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -72,10 +72,10 @@ def get_network_watcher_from_location(cmd, watcher_name="watcher_name", rg_name= | |||||
|
|
||||||
|
|
||||||
| def get_network_watcher_from_vm(cmd): | ||||||
| from ..custom import get_vm | ||||||
| args = cmd.ctx.args | ||||||
| compute_client = get_mgmt_service_client(cmd.cli_ctx, ResourceType.MGMT_COMPUTE).virtual_machines | ||||||
| vm_name = parse_resource_id(args.vm.to_serialized_data())["name"] | ||||||
| vm = compute_client.get(args.resource_group_name, vm_name) | ||||||
| vm = get_vm(cmd.cli_ctx, args.resource_group_name, vm_name) | ||||||
| args.location = vm.location | ||||||
| get_network_watcher_from_location(cmd) | ||||||
|
|
||||||
|
|
@@ -88,10 +88,10 @@ def get_network_watcher_from_resource(cmd): | |||||
|
|
||||||
|
|
||||||
| def get_network_watcher_from_vmss(cmd): | ||||||
| from ..custom import get_vmss | ||||||
| args = cmd.ctx.args | ||||||
| compute_client = get_mgmt_service_client(cmd.cli_ctx, ResourceType.MGMT_COMPUTE).virtual_machine_scale_sets | ||||||
| vmss_name = parse_resource_id(args.target.to_serialized_data())["name"] | ||||||
| vmss = compute_client.get(args.resource_group_name, vmss_name) | ||||||
| vmss = get_vmss(cmd.cli_ctx, args.resource_group_name, vmss_name) | ||||||
| args.location = vmss.location | ||||||
|
||||||
| args.location = vmss.location | |
| args.location = vmss["location"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_vmreturns the deserialized output fromVMShow(a dict), but this code still accessesvm.locationlike an SDK model. This will raiseAttributeErrorat runtime (e.g., foraz network watcher test-ip-flow,show-next-hop, etc.). Use the returned mapping to set the location (e.g.,vm["location"]/vm.get("location")) before callingget_network_watcher_from_location.