Fix gnocchi filter project for non-default domain

the keystoneclient calls used were wrong, and basically ignored
any filter_domain value, parsing all the projects.
This leads to failures to resolve project if when for example several
projects with the same name exist in different domains.

This patch adapts the resolution to proper calls - first resolve the
name of the domain to ID, than use that ID in the call to resolve the
project.

Change-Id: I91e509aa5427ee060e02591f719a815f71768618
This commit is contained in:
Pavlo Shchelokovskyy 2021-12-01 16:26:46 +02:00
parent 4ce0541619
commit c5e59317b1

View File

@ -285,9 +285,11 @@ class GnocchiPublisher(publisher.ConfigPublisherBase):
"as `self.filter_project` is None.")
return None
try:
domain = self._ks_client.domains.find(
name=self.filter_domain)
project = self._ks_client.projects.find(
name=self.filter_project,
domain=self.filter_domain)
domain_id=domain.id)
except ka_exceptions.NotFound:
LOG.warning('Filtered project [%s] not found in keystone, '
'ignoring the filter_project option' %