Fix compatibility issue when using netifaces
Force using unicode before pass the string to ipaddress.IPv4Interface(). Change-Id: Idebb198ad2751a77e7399a3809a3951f6c899dee Closes-Bug: #1743673
This commit is contained in:
parent
f88521682e
commit
fd35c7dc3e
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user