зеркало из https://github.com/Azure/ARO-RP.git
az: use resource_group_name for vnet if vnet_resource_group_name unset
This commit is contained in:
Родитель
1529b8cfeb
Коммит
bd0bc7f93d
|
@ -3,6 +3,7 @@ from azext_aro._validators import validate_client_id
|
|||
from azext_aro._validators import validate_client_secret
|
||||
from azext_aro._validators import validate_subnet
|
||||
from azext_aro._validators import validate_vnet
|
||||
from azext_aro._validators import validate_vnet_resource_group_name
|
||||
from azext_aro._validators import validate_worker_count
|
||||
from azext_aro._validators import validate_worker_vm_disk_size_gb
|
||||
from azure.cli.core.commands.parameters import name_type
|
||||
|
@ -50,7 +51,8 @@ def load_arguments(self, _):
|
|||
c.argument('vnet_resource_group_name',
|
||||
resource_group_name_type,
|
||||
options_list=['--vnet-resource-group'],
|
||||
help='Name of vnet resource group.')
|
||||
help='Name of vnet resource group.',
|
||||
validator=validate_vnet_resource_group_name)
|
||||
c.argument('vnet',
|
||||
help='Name or ID of vnet. If name is supplied, `--vnet-resource-group` must be supplied.',
|
||||
validator=validate_vnet)
|
||||
|
|
|
@ -127,12 +127,10 @@ def validate_subnets(master_subnet, worker_subnet):
|
|||
|
||||
|
||||
def validate_vnet(cmd, namespace):
|
||||
validate_vnet_resource_group_name(namespace)
|
||||
|
||||
if namespace.vnet:
|
||||
if not is_valid_resource_id(namespace.vnet):
|
||||
if not namespace.vnet_resource_group_name:
|
||||
raise CLIError(
|
||||
"Must specify --vnet-resource-group-name if --vnet is not an id.")
|
||||
|
||||
namespace.vnet = resource_id(
|
||||
subscription=get_subscription_id(cmd.cli_ctx),
|
||||
resource_group=namespace.vnet_resource_group_name,
|
||||
|
@ -142,6 +140,11 @@ def validate_vnet(cmd, namespace):
|
|||
)
|
||||
|
||||
|
||||
def validate_vnet_resource_group_name(namespace):
|
||||
if not namespace.vnet_resource_group_name:
|
||||
namespace.vnet_resource_group_name = namespace.validate_vnet_resource_group_name
|
||||
|
||||
|
||||
def validate_worker_count(namespace):
|
||||
if namespace.worker_count:
|
||||
namespace.worker_count = _validate_int(
|
||||
|
|
Загрузка…
Ссылка в новой задаче