Skip to content

Commit

Permalink
Merge 6e158bd into e2843d7
Browse files Browse the repository at this point in the history
  • Loading branch information
jerbob committed Nov 9, 2018
2 parents e2843d7 + 6e158bd commit c1b2556
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions netjsonconfig/backends/openvpn/parser.py
Expand Up @@ -4,8 +4,8 @@
from ...utils import sorted_dict
from ..base.parser import BaseParser

vpn_pattern = re.compile('^# openvpn config:\s', flags=re.MULTILINE)
config_pattern = re.compile('^([^\s]*) ?(.*)$')
vpn_pattern = re.compile(r'^# openvpn config:\s', flags=re.MULTILINE)
config_pattern = re.compile(r'^([^\s]*) ?(.*)$')
config_suffix = '.conf'


Expand Down
4 changes: 4 additions & 0 deletions netjsonconfig/backends/openwrt/converters/interfaces.py
Expand Up @@ -256,6 +256,10 @@ def __netjson_addresses(self, interface):
netmask = interface.pop('netmask', 32)
parsed_ip = self.__netjson_parse_ip(ipv4, netmask)
ipv4 = [parsed_ip] if parsed_ip else []
if not isinstance(ipv6, list):
netmask = interface.pop('netmask', 128)
parsed_ip = self.__netjson_parse_ip(ipv6, netmask)
ipv6 = [parsed_ip] if parsed_ip else []
if proto.startswith('dhcp'):
family = 'ipv4' if proto == 'dhcp' else 'ipv6'
addresses.append({'proto': 'dhcp', 'family': family})
Expand Down
6 changes: 3 additions & 3 deletions netjsonconfig/backends/openwrt/parser.py
Expand Up @@ -5,9 +5,9 @@
from ...utils import sorted_dict
from ..base.parser import BaseParser

packages_pattern = re.compile('^package\s', flags=re.MULTILINE)
block_pattern = re.compile('^config\s', flags=re.MULTILINE)
config_pattern = re.compile('^(option|list)\s*([^\s]*)\s*(.*)')
packages_pattern = re.compile(r'^package\s', flags=re.MULTILINE)
block_pattern = re.compile(r'^config\s', flags=re.MULTILINE)
config_pattern = re.compile(r'^(option|list)\s*([^\s]*)\s*(.*)')
config_path = 'etc/config/'


Expand Down
2 changes: 1 addition & 1 deletion tests/openwrt/test_backend.py
Expand Up @@ -69,7 +69,7 @@ def test_type_error(self):
with self.assertRaises(TypeError):
OpenWrt([])
with self.assertRaises(TypeError):
OpenWrt('NOTJSON[]\{\}')
OpenWrt(r'NOTJSON[]\{\}')

def test_system_invalid_timezone(self):
o = OpenWrt({
Expand Down

0 comments on commit c1b2556

Please sign in to comment.