Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/azure-cli-core/azure/cli/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ def _get_extension_suppressions(mod_loaders):
return self.command_table

def load_arguments(self, command=None):
from azure.cli.core.commands.parameters import resource_group_name_type, get_location_type, deployment_name_type
from azure.cli.core.commands.parameters import (
resource_group_name_type, get_location_type, deployment_name_type, vnet_name_type, subnet_name_type)
from knack.arguments import ignore_type

# omit specific command to load everything
Expand All @@ -370,6 +371,8 @@ def load_arguments(self, command=None):
with loader.argument_context('') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('location', get_location_type(self.cli_ctx))
c.argument('vnet_name', vnet_name_type)
c.argument('subnet', subnet_name_type)
Comment on lines +374 to +375
Copy link
Member

@jiasli jiasli May 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is somehow contradicting my understanding about vnet_name and subnet. But, yea, they can only be configured as global arguments.

c.argument('deployment_name', deployment_name_type)
c.argument('cmd', ignore_type)

Expand Down
7 changes: 0 additions & 7 deletions src/azure-cli-core/azure/cli/core/commands/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,10 @@ def get_location_type(cli_ctx):
)

vnet_name_type = CLIArgumentType(
options_list='--vnet-name',
metavar='NAME',
help='The virtual network (VNet) name.',
completer=get_resource_name_completion_list('Microsoft.Network/virtualNetworks'),
local_context_attribute=LocalContextAttribute(name='vnet_name', actions=[LocalContextAction.GET])
)

subnet_name_type = CLIArgumentType(
options_list='--subnet',
metavar='NAME',
help='The subnet name.',
local_context_attribute=LocalContextAttribute(name='subnet_name', actions=[LocalContextAction.GET]))


Expand Down