From 72eb8672bf18453049691b0bf1995e665dde5bac Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Thu, 7 Mar 2019 10:04:08 -0500 Subject: [PATCH] Don't fail if ConnectionError has no code (#53455) Fall back to normal error handling instead --- lib/ansible/utils/jsonrpc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/utils/jsonrpc.py b/lib/ansible/utils/jsonrpc.py index 9497e11ca0..530e28c1ee 100644 --- a/lib/ansible/utils/jsonrpc.py +++ b/lib/ansible/utils/jsonrpc.py @@ -45,7 +45,10 @@ class JsonRpcServer(object): result = rpc_method(*args, **kwargs) except ConnectionError as exc: display.vvv(traceback.format_exc()) - error = self.error(code=exc.code, message=to_text(exc)) + try: + error = self.error(code=exc.code, message=to_text(exc)) + except AttributeError: + error = self.internal_error(data=to_text(exc)) response = json.dumps(error) except Exception as exc: display.vvv(traceback.format_exc())