mirror of
https://github.com/ceph/ceph
synced 2025-02-24 11:37:37 +00:00
mgr/telemetry: use raise_for_status()
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
7e578e280e
commit
0e85f185b6
@ -666,23 +666,14 @@ class Module(MgrModule):
|
||||
self.log.info('Send using HTTP(S) proxy: %s', self.proxy)
|
||||
proxies['http'] = self.proxy
|
||||
proxies['https'] = self.proxy
|
||||
fail_reason = None
|
||||
try:
|
||||
resp = requests.put(url=url, json=report)
|
||||
if not resp.ok:
|
||||
fail_reason = 'Failed to send %s to %s: %d %s %s' % (
|
||||
what,
|
||||
url,
|
||||
resp.status_code,
|
||||
resp.reason,
|
||||
resp.text
|
||||
)
|
||||
resp.raise_for_status()
|
||||
except Exception as e:
|
||||
fail_reason = 'Failed to send %s to %s: %s' % (
|
||||
what, url, str(e)))
|
||||
if fail_reason:
|
||||
fail_reason = 'Failed to send %s to %s: %s' % (what, url, str(e))
|
||||
self.log.error(fail_reason)
|
||||
return fail_reason
|
||||
return fail_reason
|
||||
return None
|
||||
|
||||
def send(self, report, endpoint=None):
|
||||
if not endpoint:
|
||||
|
Loading…
Reference in New Issue
Block a user