Skip to content

Commit

Permalink
Merge pull request #1349 from grycap/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
micafer authored Mar 24, 2022
2 parents 1a33dea + cb70786 commit 736af22
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion IM/connectors/Azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
from IM.VirtualMachine import VirtualMachine
from .CloudConnector import CloudConnector
from radl.radl import Feature
from netaddr import IPNetwork, IPAddress
from IM.config import Config

try:
from azure.mgmt.resource import ResourceManagementClient
Expand Down Expand Up @@ -988,7 +990,12 @@ def setIPs(vm, network_profile, credentials, subscription_id):

for ip in ip_conf:
if ip.private_ip_address:
private_ips.append(ip.private_ip_address)
is_private = any([IPAddress(ip.private_ip_address) in IPNetwork(mask)
for mask in Config.PRIVATE_NET_MASKS])
if is_private:
private_ips.append(ip.private_ip_address)
else:
public_ips.append(ip.private_ip_address)
if ip.public_ip_address:
name = " ".join(ip.public_ip_address.id.split('/')[-1:])
sub = "".join(ip.public_ip_address.id.split('/')[4])
Expand Down

0 comments on commit 736af22

Please sign in to comment.