mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -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
|
@ -85,7 +85,12 @@ class HttpApi(HttpApiBase):
|
|||
else:
|
||||
commands.append(command)
|
||||
|
||||
response = self.send_request(commands)
|
||||
try:
|
||||
response = self.send_request(commands)
|
||||
except Exception:
|
||||
commands = ['configure session %s' % session, 'abort']
|
||||
response = self.send_request(commands, output='text')
|
||||
raise
|
||||
|
||||
commands = ['configure session %s' % session, 'show session-config diffs']
|
||||
if commit:
|
||||
|
@ -152,7 +157,13 @@ class HttpApi(HttpApiBase):
|
|||
def handle_response(response):
|
||||
if 'error' in response:
|
||||
error = response['error']
|
||||
raise ConnectionError(error['message'], code=error['code'])
|
||||
|
||||
error_text = []
|
||||
for data in error['data']:
|
||||
error_text.extend(data.get('errors', []))
|
||||
error_text = '\n'.join(error_text) or error['message']
|
||||
|
||||
raise ConnectionError(error_text, code=error['code'])
|
||||
|
||||
results = []
|
||||
for result in response['result']:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue