SHA256
1
0
forked from pool/salt
salt/avoid-traceback-when-http.query-request-cannot-be-pe.patch

36 lines
1.3 KiB
Diff

From 58504344b62fd577c0ef9c8d55378ea668a57912 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 c75ca73a85..ced01e110f 100644
--- a/salt/utils/http.py
+++ b/salt/utils/http.py
@@ -567,11 +567,13 @@ def query(url,
except 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