diff --git a/lib/ansible/module_utils/network/dellos6/dellos6.py b/lib/ansible/module_utils/network/dellos6/dellos6.py index 0077f399b6..ee98d17495 100644 --- a/lib/ansible/module_utils/network/dellos6/dellos6.py +++ b/lib/ansible/module_utils/network/dellos6/dellos6.py @@ -1,5 +1,6 @@ # # (c) 2015 Peter Sprygada, +# (c) 2017 Red Hat, Inc # # Copyright (c) 2016 Dell Inc. # @@ -122,6 +123,7 @@ def load_config(module, commands): for command in to_list(commands): if command == 'end': continue +# cmd = {'command': command, 'prompt': WARNING_PROMPTS_RE, 'answer': 'yes'} rc, out, err = exec_command(module, command) if rc != 0: module.fail_json(msg=to_text(err, errors='surrogate_or_strict'), command=command, rc=rc) @@ -168,7 +170,7 @@ def os6_parse(lines, indent=None, comment_tokens=None): re.compile(r'template.*$'), re.compile(r'address-family.*$'), re.compile(r'spanning-tree mst configuration.*$'), - re.compile(r'logging.*$'), + re.compile(r'logging (?!.*(cli-command|buffered|console|email|facility|file|monitor|protocol|snmp|source-interface|traps|web-session)).*$'), re.compile(r'(radius-server|tacacs-server) host.*$')] childline = re.compile(r'^exit$') diff --git a/lib/ansible/modules/network/dellos10/dellos10_config.py b/lib/ansible/modules/network/dellos10/dellos10_config.py index 85fe00bc81..f4d2ad2424 100644 --- a/lib/ansible/modules/network/dellos10/dellos10_config.py +++ b/lib/ansible/modules/network/dellos10/dellos10_config.py @@ -263,7 +263,7 @@ def main(): commands = dumps(configobjs, 'commands') if ((isinstance((module.params['lines']), list)) and (isinstance((module.params['lines'][0]), dict)) and - (['prompt', 'answer'].issubset(module.params['lines'][0]))): + (set(['prompt', 'answer']).issubset(module.params['lines'][0]))): cmd = {'command': commands, 'prompt': module.params['lines'][0]['prompt'], diff --git a/lib/ansible/modules/network/dellos6/dellos6_config.py b/lib/ansible/modules/network/dellos6/dellos6_config.py index 98283a6251..34926200b6 100644 --- a/lib/ansible/modules/network/dellos6/dellos6_config.py +++ b/lib/ansible/modules/network/dellos6/dellos6_config.py @@ -262,7 +262,7 @@ def main(): commands = dumps(configobjs, 'commands') if ((isinstance(module.params['lines'], list)) and (isinstance(module.params['lines'][0], dict)) and - ['prompt', 'answer'].issubset(module.params['lines'][0])): + set(['prompt', 'answer']).issubset(module.params['lines'][0])): cmd = {'command': commands, 'prompt': module.params['lines'][0]['prompt'], 'answer': module.params['lines'][0]['answer']} @@ -287,7 +287,7 @@ def main(): result['changed'] = True if not module.check_mode: cmd = {'command': 'copy running-config startup-config', - 'prompt': r'\(y/n\)$', 'answer': 'yes'} + 'prompt': r'\(y/n\)\s?$', 'answer': 'yes'} run_commands(module, [cmd]) result['saved'] = True else: diff --git a/lib/ansible/modules/network/dellos9/dellos9_config.py b/lib/ansible/modules/network/dellos9/dellos9_config.py index 339faaecf8..e8195eea8e 100644 --- a/lib/ansible/modules/network/dellos9/dellos9_config.py +++ b/lib/ansible/modules/network/dellos9/dellos9_config.py @@ -270,7 +270,7 @@ def main(): commands = dumps(configobjs, 'commands') if ((isinstance(module.params['lines'], list)) and (isinstance(module.params['lines'][0], dict)) and - ['prompt', 'answer'].issubset(module.params['lines'][0])): + set(['prompt', 'answer']).issubset(module.params['lines'][0])): cmd = {'command': commands, 'prompt': module.params['lines'][0]['prompt'], diff --git a/lib/ansible/plugins/terminal/dellos6.py b/lib/ansible/plugins/terminal/dellos6.py index cef63cba8c..3d468b0e38 100644 --- a/lib/ansible/plugins/terminal/dellos6.py +++ b/lib/ansible/plugins/terminal/dellos6.py @@ -37,17 +37,17 @@ class TerminalModule(TerminalBase): ] terminal_stderr_re = [ - re.compile(br"% ?Error: (?:(?!\bdoes not exist\b)(?!\balready exists\b)(?!\bHost not found\b)(?!\bnot active\b).)*$"), re.compile(br"% ?Bad secret"), - re.compile(br"(\bInterface is part of a port-channel\b)|(\bAn invalid interface has been used for this function\b)"), - re.compile(br"(\bThe maximum number of users have already been created\b)|(\bVLAN ID is out of range\b)|(\bUse '-' for range\b)"), - re.compile(br"(\binvalid input\b)|(\bVLAN ID not found\b)"), - re.compile(br"(\bInvalid access level. Access level can be either 0, 1 or 15\b)|(\bValue is out of range\b)"), - re.compile(br"Cannot add(.+)\s(\S+)"), + re.compile(br"(\bInterface is part of a port-channel\b)"), + re.compile(br"(\bThe maximum number of users have already been created\b)|(\bUse '-' for range\b)"), re.compile(br"Error:(.+)\s(\S+)"), re.compile(br"(?:incomplete|ambiguous) command", re.I), re.compile(br"connection timed out", re.I), re.compile(br"'[^']' +returned error code: ?\d+"), + re.compile(br"Invalid|invalid.*$", re.I), + re.compile(br"((\bout of range\b)|(\bnot found\b)|(\bCould not\b)|(\bUnable to\b)|(\bCannot\b)).*", re.I), + re.compile(br"((\balready exists\b)|(\bdoes not exist\b)|(\bnot active\b)|(\bFailed\b)|(\bIncorrect\b)|(\bnot enabled\b)).*", re.I), + ] def on_become(self, passwd=None):