Package list python-castellan / 69dfce4
Merge "Add handler for Bad Request error during Vault authentication" Zuul authored 1 year, 4 months ago Gerrit Code Review committed 1 year, 4 months ago
1 changed file(s) with 7 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
172172 if resp.status_code == requests.codes['forbidden']:
173173 raise exception.Forbidden()
174174
175 resp = resp.json()
176 self._cached_approle_token_id = resp['auth']['client_token']
175 resp_data = resp.json()
176
177 if resp.status_code == requests.codes['bad_request']:
178 raise exception.KeyManagerError(', '.join(resp_data['errors']))
179
180 self._cached_approle_token_id = resp_data['auth']['client_token']
177181 self._approle_token_issue = token_issue_utc
178 self._approle_token_ttl = resp['auth']['lease_duration']
182 self._approle_token_ttl = resp_data['auth']['lease_duration']
179183 return {'X-Vault-Token': self._approle_token_id}
180184
181185 return {}