Skip to content

Commit

Permalink
Avoid traceback when http.query request cannot be performed (bsc#1128…
Browse files Browse the repository at this point in the history
…554)

Improve error logging when http.query cannot be performed
  • Loading branch information
meaksh authored and brejoc committed Apr 8, 2020
1 parent 86ef447 commit 0938729
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion salt/utils/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0938729

Please sign in to comment.