From 168a6b4d787e1ce83bb57341f8b6e3889be780c2 Mon Sep 17 00:00:00 2001 From: Vishnu Priya Ananthu Sundaram Date: Thu, 13 Jul 2017 10:41:39 -0700 Subject: [PATCH] Fix Nic creation issue in stack (#4008) * Fix Nic creation issue in stack * Remove white space * Edits with comments for refactoring * Fix build error (long line) * Remove trailing white space --- .../azure/cli/command_modules/network/custom.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py index a6175e3c881..811947b0e58 100644 --- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py @@ -1,4 +1,4 @@ -# -------------------------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- @@ -1134,14 +1134,19 @@ def create_nic(resource_group_name, network_interface_name, subnet, location=Non public_ip_address=None, virtual_network_name=None, enable_accelerated_networking=None): client = _network_client_factory().network_interfaces NetworkInterface = get_sdk(ResourceType.MGMT_NETWORK, 'NetworkInterface', mod='models') + NetworkInterfaceDnsSettings = get_sdk( ResourceType.MGMT_NETWORK, 'NetworkInterfaceDnsSettings', mod='models') dns_settings = NetworkInterfaceDnsSettings(internal_dns_name_label=internal_dns_name_label, dns_servers=dns_servers or []) + nic = NetworkInterface(location=location, tags=tags, enable_ip_forwarding=enable_ip_forwarding, - dns_settings=dns_settings, enable_accelerated_networking=enable_accelerated_networking) + dns_settings=dns_settings) + + if supported_api_version(ResourceType.MGMT_NETWORK, min_api='2016-09-01'): + nic.enable_accelerated_networking = enable_accelerated_networking if network_security_group: nic.network_security_group = NetworkSecurityGroup(id=network_security_group)