summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Moreau Simard <dmsimard@redhat.com>2018-06-25 10:38:01 -0400
committerDavid Moreau Simard <dmsimard@redhat.com>2018-06-25 15:01:22 +0000
commit7310b6cea5891d4bb09faaa21945c03adcc6b7a6 (patch)
treeb0ace0fcedcce57e44b2bb4800ca0ad75115d438
parentb6b4818987760933c3149403fe926abf434d6b48 (diff)
Handle HTTP errors >= 500 and handle HTTP 204 on deleteHEADmaster
Notes
Notes (review): Code-Review+2: David Moreau Simard <dmsimard@redhat.com> Workflow+1: David Moreau Simard <dmsimard@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Mon, 25 Jun 2018 22:47:51 +0000 Reviewed-on: https://review.openstack.org/577844 Project: openstack/ara-clients Branch: refs/heads/master
-rw-r--r--ara/clients/offline.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/ara/clients/offline.py b/ara/clients/offline.py
index b5709c6..2d25a5b 100644
--- a/ara/clients/offline.py
+++ b/ara/clients/offline.py
@@ -54,13 +54,22 @@ class AraOfflineClient(object):
54 content_type='application/json' 54 content_type='application/json'
55 ) 55 )
56 56
57 if response.status_code >= 500:
58 self.log.error(
59 'Failed to {method} on {endpoint}: {content}'.format(
60 method=method,
61 endpoint=endpoint,
62 content=kwargs
63 )
64 )
65
57 self.log.debug('HTTP {status}: {method} on {endpoint}'.format( 66 self.log.debug('HTTP {status}: {method} on {endpoint}'.format(
58 status=response.status_code, 67 status=response.status_code,
59 method=method, 68 method=method,
60 endpoint=endpoint 69 endpoint=endpoint
61 )) 70 ))
62 71
63 if response.status_code not in [200, 201]: 72 if response.status_code not in [200, 201, 204]:
64 self.log.error( 73 self.log.error(
65 'Failed to {method} on {endpoint}: {content}'.format( 74 'Failed to {method} on {endpoint}: {content}'.format(
66 method=method, 75 method=method,
@@ -68,7 +77,9 @@ class AraOfflineClient(object):
68 content=kwargs 77 content=kwargs
69 ) 78 )
70 ) 79 )
71 self.log.fatal(response.content) 80
81 if response.status_code == 204:
82 return response
72 83
73 return response.json() 84 return response.json()
74 85