From dfe554eaf8d99b67e22fb3b1266bec8721548562 Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Thu, 15 Nov 2018 09:26:35 +0800 Subject: [PATCH] upgrading network packages (#47639) --- lib/ansible/module_utils/azure_rm_common.py | 8 ++++---- lib/ansible/modules/cloud/azure/azure_rm_appgateway.py | 4 ++-- .../modules/cloud/azure/azure_rm_loadbalancer.py | 10 +++++----- .../modules/cloud/azure/azure_rm_networkinterface.py | 2 +- lib/ansible/modules/cloud/azure/azure_rm_subnet.py | 2 +- packaging/requirements/requirements-azure.txt | 2 +- test/runner/requirements/integration.cloud.azure.txt | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/ansible/module_utils/azure_rm_common.py b/lib/ansible/module_utils/azure_rm_common.py index c33b8b7dab..f0cfa96000 100644 --- a/lib/ansible/module_utils/azure_rm_common.py +++ b/lib/ansible/module_utils/azure_rm_common.py @@ -61,7 +61,7 @@ AZURE_API_PROFILES = { snapshots='2017-03-30', virtual_machine_run_commands='2017-03-30' ), - 'NetworkManagementClient': '2017-11-01', + 'NetworkManagementClient': '2018-08-01', 'ResourceManagementClient': '2017-05-10', 'StorageManagementClient': '2017-10-01', 'WebsiteManagementClient': '2016-08-01', @@ -212,7 +212,7 @@ AZURE_PKG_VERSIONS = { }, 'NetworkManagementClient': { 'package_name': 'network', - 'expected_version': '1.7.1' + 'expected_version': '2.2.1' }, 'ResourceManagementClient': { 'package_name': 'resource', @@ -796,13 +796,13 @@ class AzureRMModuleBase(object): if not self._network_client: self._network_client = self.get_mgmt_svc_client(NetworkManagementClient, base_url=self._cloud_environment.endpoints.resource_manager, - api_version='2017-11-01') + api_version='2018-08-01') return self._network_client @property def network_models(self): self.log("Getting network models...") - return NetworkManagementClient.models("2017-11-01") + return NetworkManagementClient.models("2018-08-01") @property def rm_client(self): diff --git a/lib/ansible/modules/cloud/azure/azure_rm_appgateway.py b/lib/ansible/modules/cloud/azure/azure_rm_appgateway.py index 7270a23218..5ca522094f 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_appgateway.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_appgateway.py @@ -434,7 +434,7 @@ from ansible.module_utils.common.dict_transformations import ( try: from msrestazure.azure_exceptions import CloudError - from msrestazure.azure_operation import AzureOperationPoller + from msrest.polling import LROPoller from azure.mgmt.network import NetworkManagementClient from msrest.serialization import Model except ImportError: @@ -835,7 +835,7 @@ class AzureRMApplicationGateways(AzureRMModuleBase): response = self.mgmt_client.application_gateways.create_or_update(resource_group_name=self.resource_group, application_gateway_name=self.name, parameters=self.parameters) - if isinstance(response, AzureOperationPoller): + if isinstance(response, LROPoller): response = self.get_poller_result(response) except CloudError as exc: diff --git a/lib/ansible/modules/cloud/azure/azure_rm_loadbalancer.py b/lib/ansible/modules/cloud/azure/azure_rm_loadbalancer.py index 3039cf5232..982bd6531c 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_loadbalancer.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_loadbalancer.py @@ -693,7 +693,7 @@ class AzureRMLoadBalancer(AzureRMModuleBase): inbound_nat_pools_param = [self.network_models.InboundNatPool( name=item.get('name'), frontend_ip_configuration=self.network_models.SubResource( - frontend_ip_configuration_id( + id=frontend_ip_configuration_id( self.subscription_id, self.resource_group, self.name, @@ -707,7 +707,7 @@ class AzureRMLoadBalancer(AzureRMModuleBase): load_balancing_rules_param = [self.network_models.LoadBalancingRule( name=item.get('name'), frontend_ip_configuration=self.network_models.SubResource( - frontend_ip_configuration_id( + id=frontend_ip_configuration_id( self.subscription_id, self.resource_group, self.name, @@ -715,7 +715,7 @@ class AzureRMLoadBalancer(AzureRMModuleBase): ) ), backend_address_pool=self.network_models.SubResource( - backend_address_pool_id( + id=backend_address_pool_id( self.subscription_id, self.resource_group, self.name, @@ -723,7 +723,7 @@ class AzureRMLoadBalancer(AzureRMModuleBase): ) ), probe=self.network_models.SubResource( - probe_id( + id=probe_id( self.subscription_id, self.resource_group, self.name, @@ -739,7 +739,7 @@ class AzureRMLoadBalancer(AzureRMModuleBase): ) for item in self.load_balancing_rules] if self.load_balancing_rules else None self.new_load_balancer = self.network_models.LoadBalancer( - sku=self.network_models.LoadBalancerSku(self.sku) if self.sku else None, + sku=self.network_models.LoadBalancerSku(name=self.sku) if self.sku else None, location=self.location, tags=self.tags, frontend_ip_configurations=frontend_ip_configurations_param, diff --git a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py index 799e78ebec..12a9425091 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py @@ -614,7 +614,7 @@ class AzureRMNetworkInterface(AzureRMModuleBase): if changed: if self.state == 'present': subnet = self.network_models.SubResource( - '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/virtualNetworks/{2}/subnets/{3}'.format( + id='/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/virtualNetworks/{2}/subnets/{3}'.format( self.virtual_network['subscription_id'], self.virtual_network['resource_group'], self.virtual_network['name'], diff --git a/lib/ansible/modules/cloud/azure/azure_rm_subnet.py b/lib/ansible/modules/cloud/azure/azure_rm_subnet.py index 652b96d488..573c034e1d 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_subnet.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_subnet.py @@ -322,7 +322,7 @@ class AzureRMSubnet(AzureRMModuleBase): address_prefix=results['address_prefix'] ) if results['network_security_group'].get('id'): - subnet.network_security_group = self.network_models.NetworkSecurityGroup(results['network_security_group'].get('id')) + subnet.network_security_group = self.network_models.NetworkSecurityGroup(id=results['network_security_group'].get('id')) if self.route_table: subnet.route_table = self.network_models.RouteTable(id=self.route_table) diff --git a/packaging/requirements/requirements-azure.txt b/packaging/requirements/requirements-azure.txt index 081007f3b0..291d8c46e2 100644 --- a/packaging/requirements/requirements-azure.txt +++ b/packaging/requirements/requirements-azure.txt @@ -13,7 +13,7 @@ azure-mgmt-dns==1.2.0 azure-mgmt-keyvault==0.40.0 azure-mgmt-marketplaceordering==0.1.0 azure-mgmt-monitor==0.5.2 -azure-mgmt-network==1.7.1 +azure-mgmt-network==2.3.0 azure-mgmt-nspkg==2.0.0 azure-mgmt-rdbms==1.4.1 azure-mgmt-resource==1.2.2 diff --git a/test/runner/requirements/integration.cloud.azure.txt b/test/runner/requirements/integration.cloud.azure.txt index 081007f3b0..291d8c46e2 100644 --- a/test/runner/requirements/integration.cloud.azure.txt +++ b/test/runner/requirements/integration.cloud.azure.txt @@ -13,7 +13,7 @@ azure-mgmt-dns==1.2.0 azure-mgmt-keyvault==0.40.0 azure-mgmt-marketplaceordering==0.1.0 azure-mgmt-monitor==0.5.2 -azure-mgmt-network==1.7.1 +azure-mgmt-network==2.3.0 azure-mgmt-nspkg==2.0.0 azure-mgmt-rdbms==1.4.1 azure-mgmt-resource==1.2.2