Fix an error on not finding log handler

Magnum client should not log any warning message if there is no logging
handler. Otherwise, magnum client will print a confusing message when
server return a failure status. Below is the exact message:

No handlers could be found for logger "magnumclient.common.httpclient"

This message is just a warning that can be safely ignored. In particular,
this message does not indicate the root cause of the problem. Users
should find the root cause from other places (e.g. the server logs).

Change-Id: If6ba4f1bb4900b5632049e8a8a8bfd3b12035f8d
This commit is contained in:
Hongbin Lu 2015-01-14 19:47:02 +00:00
parent ad0d125575
commit 5b59253667
1 changed files with 2 additions and 1 deletions

View File

@ -172,7 +172,8 @@ class HTTPClient(object):
self.log_http_response(resp)
if 400 <= resp.status < 600:
LOG.warn("Request returned failure status.")
if LOG.handlers:
LOG.warn("Request returned failure status.")
error_json = self._extract_error_json(body_str)
raise exceptions.from_response(
resp, error_json.get('faultstring'),