azure_rm_deployment: fix rg issue with _nic_to_public_ips_instance() (#2950)

Fix an issue with _nic_to_public_ips_instance() function. There was an assumption in the code that the Public IP sits in the same resource group, this isn't always the case.
This commit is contained in:
Morgan Jones 2016-10-21 23:20:45 +01:00 committed by Matt Clay
parent 90cc40e105
commit be19af02f7

View file

@ -644,7 +644,7 @@ class AzureRMDeploymentManager(AzureRMModuleBase):
return ip_dict
def _nic_to_public_ips_instance(self, nics):
return [self.network_client.public_ip_addresses.get(self.resource_group_name, public_ip_id.split('/')[-1])
return [self.network_client.public_ip_addresses.get(public_ip_id.split('/')[4], public_ip_id.split('/')[-1])
for nic_obj in [self.network_client.network_interfaces.get(self.resource_group_name,
nic['dep'].resource_name) for nic in nics]
for public_ip_id in [ip_conf_instance.public_ip_address.id