summaryrefslogtreecommitdiff
path: root/ceilometer
diff options
context:
space:
mode:
authorRafael Weingärtner <rafael@apache.org>2022-09-07 14:16:53 -0300
committerRafael Weingärtner <rafael@apache.org>2022-09-07 15:42:03 -0300
commit37bf3efb287e755cff7ab4855ea03d6c15bf9752 (patch)
treef206f21e487b462fb86afac861e7b0b7e45fed43 /ceilometer
parentfb184a9e594acfd22d6d15cc71fb5d8f94752a17 (diff)
downloadceilometer-37bf3efb287e755cff7ab4855ea03d6c15bf9752.tar.gz
Fix Non-OpenStack dynamic pollster credentials handling
There was a problem with the barbican credentials processing for Non-OpenStack dynamic pollster. The credentials variables would be retrieved as a byte string, which would break the processing. Therefore, we needed to introduce a method to check if the credentials are a String object. if they are not, we convert them to String. Change-Id: I2084061eb8f543d4c557963599732e35cfa22996
Diffstat (limited to 'ceilometer')
-rw-r--r--ceilometer/polling/dynamic_pollster.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/ceilometer/polling/dynamic_pollster.py b/ceilometer/polling/dynamic_pollster.py
index bb45b85f..2e9ea4ac 100644
--- a/ceilometer/polling/dynamic_pollster.py
+++ b/ceilometer/polling/dynamic_pollster.py
@@ -850,6 +850,9 @@ class NonOpenStackApisSamplesGatherer(PollsterSampleGatherer):
if override_credentials:
credentials = override_credentials
+ if not isinstance(credentials, str):
+ credentials = self.normalize_credentials_to_string(credentials)
+
url = self.get_request_linked_samples_url(kwargs, definitions)
authenticator_module_name = definitions['module']
@@ -878,6 +881,17 @@ class NonOpenStackApisSamplesGatherer(PollsterSampleGatherer):
return resp, url
+ @staticmethod
+ def normalize_credentials_to_string(credentials):
+ if isinstance(credentials, bytes):
+ credentials = credentials.decode('utf-8')
+ else:
+ credentials = str(credentials)
+ LOG.debug("Credentials [%s] were not defined as a string. "
+ "Therefore, we converted it to a string like object.",
+ credentials)
+ return credentials
+
def create_request_arguments(self, definitions):
request_arguments = super(
NonOpenStackApisSamplesGatherer, self).create_request_arguments(