From fd35c7dc3ea95c30eb12bee61af9edc2f208b8aa Mon Sep 17 00:00:00 2001 From: Jianghua Wang Date: Wed, 17 Jan 2018 01:34:40 +0000 Subject: [PATCH] Fix compatibility issue when using netifaces Force using unicode before pass the string to ipaddress.IPv4Interface(). Change-Id: Idebb198ad2751a77e7399a3809a3951f6c899dee Closes-Bug: #1743673 --- os_xenapi/utils/himn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os_xenapi/utils/himn.py b/os_xenapi/utils/himn.py index ca56b62..029de76 100644 --- a/os_xenapi/utils/himn.py +++ b/os_xenapi/utils/himn.py @@ -51,7 +51,7 @@ def get_local_himn_eth_via_ip(ip_in_himn, eths=None): ipv4s = netifaces.ifaddresses(eth).get(netifaces.AF_INET, []) for ipv4 in ipv4s: net_if = ipaddress.IPv4Interface( - ipv4['addr'] + '/' + ipv4['netmask']) + ipv4['addr'] + u'/' + ipv4['netmask']) if isinstance(ip_in_himn, bytes): ip_in_himn = ip_in_himn.decode('utf-8') hint_himn_ipaddr = ipaddress.ip_address(ip_in_himn)