Skip to content

Commit

Permalink
[raspbian] Converted ipaddresses to unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
Ritwick DSouza committed Aug 22, 2017
1 parent f88a893 commit 461df0a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions netjsonconfig/backends/raspbian/converters/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _get_address(self, interface):
if address.get('family') == 'ipv4':

address_mask = str(address.get('address')) + '/' + str(address.get('mask'))
address['netmask'] = IPv4Interface(address_mask).with_netmask.split('/')[1]
address['netmask'] = IPv4Interface(address_mask.decode('utf-8')).with_netmask.split('/')[1]
del address['mask']
if address.get('family') == 'ipv6':
address['netmask'] = address['mask']
Expand All @@ -68,14 +68,14 @@ def _get_address(self, interface):
def _get_route(self, routes):
result = []
for route in routes:
if ip_network(route.get('next')).version == 4:
if ip_network(route.get('next').decode('utf-8')).version == 4:
route['version'] = 4
destination = IPv4Interface(route['destination']).with_netmask
destination = IPv4Interface(route['destination'].decode('utf-8')).with_netmask
dest, dest_mask = destination.split('/')
route['dest'] = dest
route['dest_mask'] = dest_mask
del route['destination']
elif ip_network(route.get('next')).version == 6:
elif ip_network(route.get('next').decode('utf-8')).version == 6:
route['version'] = 6
result.append(route)
return routes

0 comments on commit 461df0a

Please sign in to comment.