File tree Expand file tree Collapse file tree
netjsonconfig/backends/raspbian/converters Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from ipaddress import IPv4Interface , ip_network
22
3+ import six
4+
35from ....utils import get_copy
46from .base import RaspbianConverter
57
@@ -58,7 +60,7 @@ def _get_address(self, interface):
5860 if address .get ('family' ) == 'ipv4' :
5961
6062 address_mask = str (address .get ('address' )) + '/' + str (address .get ('mask' ))
61- address ['netmask' ] = IPv4Interface (address_mask ).with_netmask .split ('/' )[1 ]
63+ address ['netmask' ] = IPv4Interface (six . text_type ( address_mask ) ).with_netmask .split ('/' )[1 ]
6264 del address ['mask' ]
6365 if address .get ('family' ) == 'ipv6' :
6466 address ['netmask' ] = address ['mask' ]
@@ -68,14 +70,14 @@ def _get_address(self, interface):
6870 def _get_route (self , routes ):
6971 result = []
7072 for route in routes :
71- if ip_network (route .get ('next' )).version == 4 :
73+ if ip_network (six . text_type ( route .get ('next' ) )).version == 4 :
7274 route ['version' ] = 4
73- destination = IPv4Interface (route ['destination' ]).with_netmask
75+ destination = IPv4Interface (six . text_type ( route ['destination' ]) ).with_netmask
7476 dest , dest_mask = destination .split ('/' )
7577 route ['dest' ] = dest
7678 route ['dest_mask' ] = dest_mask
7779 del route ['destination' ]
78- elif ip_network (route .get ('next' )).version == 6 :
80+ elif ip_network (six . text_type ( route .get ('next' ) )).version == 6 :
7981 route ['version' ] = 6
8082 result .append (route )
8183 return routes
You can’t perform that action at this time.
0 commit comments