eos_config: Added fix for bug #54400 - support for !! in config mode (#63694)

* Corrected lint errors

* Added fix for bug # 54400

* Resolving conflicts
This commit is contained in:
GomathiselviS 2020-01-17 15:22:38 -05:00 committed by Nathaniel Case
parent a7e4479d01
commit 7ddf7474d3
2 changed files with 6 additions and 6 deletions

View file

@ -164,7 +164,6 @@ class NetworkConfig(object):
self._indent = indent self._indent = indent
self._items = list() self._items = list()
self._config_text = None self._config_text = None
if ignore_lines: if ignore_lines:
for item in ignore_lines: for item in ignore_lines:
if not isinstance(item, Pattern): if not isinstance(item, Pattern):
@ -220,15 +219,16 @@ class NetworkConfig(object):
config = list() config = list()
indents = [0] indents = [0]
for linenum, line in enumerate(to_native(lines, errors='surrogate_or_strict').split('\n')): for linenum, line in enumerate(to_native(lines, errors='surrogate_or_strict').split('\n')):
text = entry_reg.sub('', line).strip() text = entry_reg.sub('', line).strip()
cfg = ConfigLine(line) cfg = ConfigLine(line)
if not text or ignore_line(text, comment_tokens): if not text or ignore_line(text, comment_tokens):
# To accomodate !! comments in config mode
if "!!" in text:
pass
else:
continue continue
# handle top level commands # handle top level commands
if toplevel.match(line): if toplevel.match(line):
ancestors = [cfg] ancestors = [cfg]
@ -377,7 +377,6 @@ class NetworkConfig(object):
expanded.append(p) expanded.append(p)
expanded.append(item) expanded.append(item)
visited.add(item.line) visited.add(item.line)
return expanded return expanded
def add(self, lines, parents=None): def add(self, lines, parents=None):

View file

@ -1,4 +1,5 @@
ip access-list test ip access-list test
!! Adding comment
10 permit ip host 192.168.0.2 host 192.168.0.1 10 permit ip host 192.168.0.2 host 192.168.0.1
20 permit ip host 192.168.0.1 host 192.168.0.2 20 permit ip host 192.168.0.1 host 192.168.0.2
! !