File avoid-traceback-when-http.query-request-cannot-be-pe.patch of Package salt.14915

From 36433f3f81fb45ff40ed2d294494342c9f622c2e 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 78043b1d6c..1b7dff6202 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.21.0


openSUSE Build Service is sponsored by