From 7ddf7474d3cfc376bdb1da6151265dbc1db93c87 Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Fri, 17 Jan 2020 15:22:38 -0500 Subject: [PATCH] eos_config: Added fix for bug #54400 - support for !! in config mode (#63694) * Corrected lint errors * Added fix for bug # 54400 * Resolving conflicts --- lib/ansible/module_utils/network/common/config.py | 11 +++++------ .../targets/eos_config/templates/basic/cmds.j2 | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ansible/module_utils/network/common/config.py b/lib/ansible/module_utils/network/common/config.py index 974d346098b..3eaa35eb7d0 100644 --- a/lib/ansible/module_utils/network/common/config.py +++ b/lib/ansible/module_utils/network/common/config.py @@ -164,7 +164,6 @@ class NetworkConfig(object): self._indent = indent self._items = list() self._config_text = None - if ignore_lines: for item in ignore_lines: if not isinstance(item, Pattern): @@ -220,15 +219,16 @@ class NetworkConfig(object): config = list() indents = [0] - for linenum, line in enumerate(to_native(lines, errors='surrogate_or_strict').split('\n')): text = entry_reg.sub('', line).strip() cfg = ConfigLine(line) - if not text or ignore_line(text, comment_tokens): - continue - + # To accomodate !! comments in config mode + if "!!" in text: + pass + else: + continue # handle top level commands if toplevel.match(line): ancestors = [cfg] @@ -377,7 +377,6 @@ class NetworkConfig(object): expanded.append(p) expanded.append(item) visited.add(item.line) - return expanded def add(self, lines, parents=None): diff --git a/test/integration/targets/eos_config/templates/basic/cmds.j2 b/test/integration/targets/eos_config/templates/basic/cmds.j2 index c68cce8e17c..ea7ac7f0931 100644 --- a/test/integration/targets/eos_config/templates/basic/cmds.j2 +++ b/test/integration/targets/eos_config/templates/basic/cmds.j2 @@ -1,4 +1,5 @@ ip access-list test +!! Adding comment 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 !