1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

module_utils_fix_dellos6 (#28060)

This commit is contained in:
abirami-n 2017-09-12 22:54:36 +05:30 committed by John R Barker
parent c0000bc722
commit adc533804a
2 changed files with 8 additions and 4 deletions

View file

@ -168,7 +168,7 @@ def os6_parse(lines, indent=None, comment_tokens=None):
re.compile(r'support-assist.*$'), re.compile(r'support-assist.*$'),
re.compile(r'template.*$'), re.compile(r'template.*$'),
re.compile(r'address-family.*$'), 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'logging.*$'),
re.compile(r'(radius-server|tacacs-server) host.*$')] re.compile(r'(radius-server|tacacs-server) host.*$')]
@ -214,7 +214,7 @@ def os6_parse(lines, indent=None, comment_tokens=None):
if parent: if parent:
cfg._parents.extend(parent) cfg._parents.extend(parent)
parent = list() parent = list()
config.append(cfg) config.append(cfg)
# handle sublevel children # handle sublevel children
elif parent_match is False and len(parent) > 0: elif parent_match is False and len(parent) > 0:
if not children: if not children:
@ -240,7 +240,11 @@ class Dellos6NetworkConfig(NetworkConfig):
for item in self.items: for item in self.items:
if str(item) == "exit": if str(item) == "exit":
for diff_item in diff: 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) diff.append(item)
break break
elif item not in other: elif item not in other:

View file

@ -48,7 +48,7 @@ class TerminalModule(TerminalBase):
cmd = {u'command': u'enable'} cmd = {u'command': u'enable'}
if passwd: 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 cmd[u'answer'] = passwd
try: try:
self._exec_cli_command(to_bytes(json.dumps(cmd), errors='surrogate_or_strict')) self._exec_cli_command(to_bytes(json.dumps(cmd), errors='surrogate_or_strict'))