Fix anomalous backslashes and enable pylint test.

This commit is contained in:
Matt Clay
2017-11-21 22:22:40 -08:00
parent 9735a70059
commit c6bb6c72cc
30 changed files with 76 additions and 77 deletions

View File

@@ -125,7 +125,7 @@ def has_vrf(module, vrf):
if _CONFIGURED_VRFS is not None:
return vrf in _CONFIGURED_VRFS
config = get_config(module)
_CONFIGURED_VRFS = re.findall('vrf context (\S+)', config)
_CONFIGURED_VRFS = re.findall(r'vrf context (\S+)', config)
return vrf in _CONFIGURED_VRFS
def map_obj_to_commands(want, have, module):
@@ -207,13 +207,13 @@ def map_obj_to_commands(want, have, module):
return commands
def parse_hostname(config):
match = re.search('^hostname (\S+)', config, re.M)
match = re.search(r'^hostname (\S+)', config, re.M)
if match:
return match.group(1)
def parse_domain_name(config, vrf_config):
objects = list()
regex = re.compile('ip domain-name (\S+)')
regex = re.compile(r'ip domain-name (\S+)')
match = regex.search(config, re.M)
if match:
@@ -229,11 +229,11 @@ def parse_domain_name(config, vrf_config):
def parse_domain_search(config, vrf_config):
objects = list()
for item in re.findall('^ip domain-list (\S+)', config, re.M):
for item in re.findall(r'^ip domain-list (\S+)', config, re.M):
objects.append({'name': item, 'vrf': None})
for vrf, cfg in iteritems(vrf_config):
for item in re.findall('ip domain-list (\S+)', cfg, re.M):
for item in re.findall(r'ip domain-list (\S+)', cfg, re.M):
objects.append({'name': item, 'vrf': vrf})
return objects
@@ -257,7 +257,7 @@ def parse_name_servers(config, vrf_config, vrfs):
return objects
def parse_system_mtu(config):
match = re.search('^system jumbomtu (\d+)', config, re.M)
match = re.search(r'^system jumbomtu (\d+)', config, re.M)
if match:
return int(match.group(1))
@@ -267,7 +267,7 @@ def map_config_to_obj(module):
vrf_config = {}
vrfs = re.findall('^vrf context (\S+)$', config, re.M)
vrfs = re.findall(r'^vrf context (\S+)$', config, re.M)
for vrf in vrfs:
config_data = configobj.get_block_config(path=['vrf context %s' % vrf])
vrf_config[vrf] = config_data