mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-09 01:44:03 -07:00
restconf_config module (#51971)
* Add restconf_config module * Try to do the right thing when given partial paths * Add PATCH * Delete should not require content * Non-JSON exceptions need raising, too * Let ConnectionError objects pass through exec_jsonrpc
This commit is contained in:
parent
5cc6a70398
commit
d5aabd02ba
5 changed files with 196 additions and 12 deletions
|
@ -8,6 +8,7 @@ import json
|
|||
import traceback
|
||||
|
||||
from ansible.module_utils._text import to_text
|
||||
from ansible.module_utils.connection import ConnectionError
|
||||
from ansible.module_utils.six import binary_type
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
@ -42,6 +43,10 @@ class JsonRpcServer(object):
|
|||
else:
|
||||
try:
|
||||
result = rpc_method(*args, **kwargs)
|
||||
except ConnectionError as exc:
|
||||
display.vvv(traceback.format_exc())
|
||||
error = self.error(code=exc.code, message=to_text(exc))
|
||||
response = json.dumps(error)
|
||||
except Exception as exc:
|
||||
display.vvv(traceback.format_exc())
|
||||
error = self.internal_error(data=to_text(exc, errors='surrogate_then_replace'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue