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

Add regex to catch ios error prompt (#35007)

*  Move the error checking from ios_l3_module
   to ios termianl plugin by adding additional
   regex to catch error prompt.
This commit is contained in:
Ganesh Nalawade 2018-01-19 23:50:02 +05:30 committed by GitHub
parent 585862e4d0
commit b3b3c0ec54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View file

@ -302,12 +302,7 @@ def main():
if commands:
if not module.check_mode:
response = load_config(module, commands)
for item in response:
for cmd, rsp in iteritems(item):
for err in ('Error:', 'overlaps with', 'Bad mask'):
if err in rsp:
module.fail_json(msg="command '%s' failed with error '%s'." % (cmd, rsp))
load_config(module, commands)
result['changed'] = True

View file

@ -43,6 +43,10 @@ class TerminalModule(TerminalBase):
re.compile(br"connection timed out", re.I),
re.compile(br"[^\r\n]+ not found"),
re.compile(br"'[^']' +returned error code: ?\d+"),
re.compile(br"Bad mask", re.I),
re.compile(br"% ?(\S+) ?overlaps with ?(\S+)", re.I),
re.compile(br"[%\S] ?Error: ?[\s]+", re.I),
re.compile(br"[%\S] ?Informational: ?[\s]+", re.I)
]
def on_open_shell(self):