From 09a244fc135792a859ebe6331101444d0af70b23 Mon Sep 17 00:00:00 2001 From: Yuwei Zhou Date: Thu, 25 Jan 2018 10:53:28 +0800 Subject: [PATCH] subnet should in the virtual network resource group (#35038) (cherry picked from commit bec4dcd66c2721e342ea0e0f978011f79840af6d) --- lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py index fb288c0209..c1cc20ef67 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py @@ -1467,11 +1467,11 @@ class AzureRMVirtualMachine(AzureRMModuleBase): # Find a virtual network no_vnets_msg = "Error: unable to find virtual network in resource group {0}. A virtual network " \ "with at least one subnet must exist in order to create a NIC for the virtual " \ - "machine.".format(self.resource_group) + "machine.".format(virtual_network_resource_group) virtual_network_name = None try: - vnets = self.network_client.virtual_networks.list(self.resource_group) + vnets = self.network_client.virtual_networks.list(virtual_network_resource_group) except CloudError: self.log('cloud error!') self.fail(no_vnets_msg) @@ -1486,7 +1486,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase): if self.subnet_name: try: - subnet = self.network_client.subnets.get(self.resource_group, virtual_network_name, self.subnet_name) + subnet = self.network_client.subnets.get(virtual_network_resource_group, virtual_network_name, self.subnet_name) subnet_id = subnet.id except Exception as exc: self.fail("Error: fetching subnet {0} - {1}".format(self.subnet_name, str(exc)))