diff --git a/proxmox.py b/proxmox.py index f5d29ca..a19de1f 100755 --- a/proxmox.py +++ b/proxmox.py @@ -208,14 +208,26 @@ class ProxmoxAPI(object): if type(networks) is dict: for network in networks: for ip_address in ['ip-address']: - try: - # IP address validation - if socket.inet_aton(ip_address): - # Ignore localhost - if ip_address != '127.0.0.1': - return ip_address - except socket.error: - pass + try: + # IP address validation + if socket.inet_aton(ip_address): + # Ignore localhost + if ip_address != '127.0.0.1': + return ip_address + except socket.error: + pass + elif type(networks) is list: + for network in networks: + if 'ip-addresses' in network: + for ip_address in network['ip-addresses']: + try: + # IP address validation + if socket.inet_aton(ip_address['ip-address']): + # Ignore localhost + if ip_address['ip-address'] != '127.0.0.1': + return ip_address['ip-address'] + except socket.error: + pass return None def openvz_ip_address(self, node, vm):