Skip to content
Merged
Changes from 1 commit
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
Next Next commit
remove unnecessary writing operation for subnet
  • Loading branch information
DaeunYim committed May 7, 2021
commit 7938e7b47704e31e02c2464ed9cc224497a8328b
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,14 @@ def _create_vnet_subnet_delegation(cmd, nw_client, resource_client, delegation_s
def _create_subnet_delegation(cmd, nw_client, resource_client, delegation_service_name, resource_group, vnet_name, subnet_name, location, server_name, subnet_address_pref):
Delegation, Subnet, ServiceEndpoint = cmd.get_models('Delegation', 'Subnet', 'ServiceEndpointPropertiesFormat', resource_type=ResourceType.MGMT_NETWORK)
delegation = Delegation(name=delegation_service_name, service_name=delegation_service_name)
service_endpoint = ServiceEndpoint(service='Microsoft.Storage')

# subnet exist
if not check_existence(resource_client, subnet_name, resource_group, 'Microsoft.Network', 'subnets', parent_name=vnet_name, parent_type='virtualNetworks'):
subnet_result = Subnet(
name=subnet_name,
location=location,
address_prefix=subnet_address_pref,
delegations=[delegation],
service_endpoints=[service_endpoint])
delegations=[delegation])

vnet = nw_client.virtual_networks.get(resource_group, vnet_name)
vnet_subnet_prefixes = [subnet.address_prefix for subnet in vnet.subnets]
Expand All @@ -164,7 +162,6 @@ def _create_subnet_delegation(cmd, nw_client, resource_client, delegation_servic
raise CLIError("Can not use subnet with existing delegations other than {}".format(
delegation_service_name))

subnet.service_endpoints = [service_endpoint]
subnet.delegations = [delegation]
subnet = nw_client.subnets.begin_create_or_update(resource_group, vnet_name, subnet_name, subnet).result()

Expand Down