From 3483040a170de07470987d5678f634c1e13719d1 Mon Sep 17 00:00:00 2001 From: abirami-n Date: Tue, 12 Sep 2017 22:54:36 +0530 Subject: [PATCH] module_utils_fix_dellos6 (#28060) (cherry picked from commit adc533804ae63670bb952973cdd9efc178eb1270) --- lib/ansible/module_utils/dellos6.py | 10 +++++++--- lib/ansible/plugins/terminal/dellos6.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/ansible/module_utils/dellos6.py b/lib/ansible/module_utils/dellos6.py index 95aa280087..e879c09f1a 100644 --- a/lib/ansible/module_utils/dellos6.py +++ b/lib/ansible/module_utils/dellos6.py @@ -159,7 +159,7 @@ def os6_parse(lines, indent=None, comment_tokens=None): re.compile(r'support-assist.*$'), re.compile(r'template.*$'), re.compile(r'address-family.*$'), - re.compile(r'spanning-tree mst.*$'), + re.compile(r'spanning-tree mst configuration.*$'), re.compile(r'logging.*$'), re.compile(r'(radius-server|tacacs-server) host.*$')] @@ -205,7 +205,7 @@ def os6_parse(lines, indent=None, comment_tokens=None): if parent: cfg._parents.extend(parent) parent = list() - config.append(cfg) + config.append(cfg) # handle sublevel children elif parent_match is False and len(parent) > 0: if not children: @@ -231,7 +231,11 @@ class Dellos6NetworkConfig(NetworkConfig): for item in self.items: if str(item) == "exit": for diff_item in diff: - if item._parents == diff_item._parents: + if diff_item._parents: + if item._parents == diff_item._parents: + diff.append(item) + break + else: diff.append(item) break elif item not in other: diff --git a/lib/ansible/plugins/terminal/dellos6.py b/lib/ansible/plugins/terminal/dellos6.py index 4a9272130c..c238f6ff74 100644 --- a/lib/ansible/plugins/terminal/dellos6.py +++ b/lib/ansible/plugins/terminal/dellos6.py @@ -48,7 +48,7 @@ class TerminalModule(TerminalBase): cmd = {u'command': u'enable'} if passwd: - cmd[u'prompt'] = to_text(r"[\r\n]?password: $", errors='surrogate_or_strict') + cmd[u'prompt'] = to_text(r"[\r\n]?password:$", errors='surrogate_or_strict') cmd[u'answer'] = passwd try: self._exec_cli_command(to_bytes(json.dumps(cmd), errors='surrogate_or_strict'))