[fix] Openstack exporter update

This ps updates the logic to clear the token when it
receives authorization error from keystone.
This is a special case of 401.
When the exporter receives a 401 error from the keystone and the
application is not placement, we reset the token value such that on the
next retry it reinitialize the parameters.

Change-Id: I0c4bcb17aa420e31591405b6000a2db2821e2428
This commit is contained in:
Radhika Pai 2021-03-18 17:45:58 +00:00
parent f4cc60b8b1
commit 1a6082fda1
1 changed files with 4 additions and 0 deletions

View File

@ -96,6 +96,10 @@ class CheckOSApi(OSBase):
name, status_code, check['expect'])
)
status = self.FAIL
if status_code == 401 and name != 'placement':
self.osclient.clear_token()
logger.info(
"Received 401 authorization error. Resetting the token.")
else:
status = self.OK