File avoid-traceback-when-http.query-request-cannot-be-pe.patch of Package salt.16896
From e45658e074fbf8c038816dc56b86c3daf33d6ebc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Mon, 29 Jul 2019 11:17:53 +0100
Subject: [PATCH] Avoid traceback when http.query request cannot be
performed (bsc#1128554)
Improve error logging when http.query cannot be performed
---
salt/utils/http.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/salt/utils/http.py b/salt/utils/http.py
index dee0563679..c2fdffb266 100644
--- a/salt/utils/http.py
+++ b/salt/utils/http.py
@@ -580,11 +580,13 @@ def query(url,
except salt.ext.tornado.httpclient.HTTPError as exc:
ret['status'] = exc.code
ret['error'] = six.text_type(exc)
+ log.error("Cannot perform 'http.query': {0} - {1}".format(url_full, ret['error']))
return ret
- except socket.gaierror as exc:
+ except (socket.herror, socket.error, socket.timeout, socket.gaierror) as exc:
if status is True:
ret['status'] = 0
ret['error'] = six.text_type(exc)
+ log.error("Cannot perform 'http.query': {0} - {1}".format(url_full, ret['error']))
return ret
if stream is True or handle is True:
--
2.16.4