Skip to content

Commit

Permalink
Fix pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
mohierf committed Jul 27, 2018
1 parent 49bc6ed commit cf20053
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions alignak_backend_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,15 +596,16 @@ def patch(self, endpoint, data, headers=None, inception=False):

if response.status_code == 200:
return self.decode(response=response)
elif response.status_code == 412:

if response.status_code == 412:
# 412 means Precondition failed, but confirm ...
if inception:
# update etag and retry to patch
resp = self.get(endpoint)
headers = {'If-Match': resp['_etag']}
return self.patch(endpoint, data=data, headers=headers, inception=False)
else:
raise BackendException(response.status_code, response.content)

raise BackendException(response.status_code, response.content)
else: # pragma: no cover - should never occur
raise BackendException(response.status_code, response.content)

Expand Down

0 comments on commit cf20053

Please sign in to comment.