mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-05 07:54:00 -07:00
Eos subnet overlap fix (#43023)
* Detect overlapping subnet & provide better errors
This commit is contained in:
parent
e129616ba6
commit
dba975470d
3 changed files with 21 additions and 5 deletions
|
@ -153,7 +153,7 @@ class Cli:
|
|||
try:
|
||||
response = conn.edit_config(commands, commit, replace)
|
||||
except ConnectionError as exc:
|
||||
message = getattr(exc, 'err', exc)
|
||||
message = getattr(exc, 'err', to_text(exc))
|
||||
if "check mode is not supported without configuration session" in message:
|
||||
self._module.warn("EOS can not check config without config session")
|
||||
response = {'changed': True}
|
||||
|
@ -341,7 +341,11 @@ class Eapi:
|
|||
commands = ['configure session %s' % session, 'abort']
|
||||
self.send_request(commands)
|
||||
err = response['error']
|
||||
self._module.fail_json(msg=err['message'], code=err['code'])
|
||||
error_text = []
|
||||
for data in err['data']:
|
||||
error_text.extend(data.get('errors', []))
|
||||
error_text = '\n'.join(error_text) or err['message']
|
||||
self._module.fail_json(msg=error_text, code=err['code'])
|
||||
|
||||
commands = ['configure session %s' % session, 'show session-config diffs']
|
||||
if commit:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue