Skip to content

Commit 8d0ea78

Browse files
committed
Use system_scope for Keystone operations
This change creates a Keystone client with a system_scope of all, so that Keystone operations (i.e. getting users) do not fail. Fixes #108 Sem-Ver: bugfix
1 parent b744017 commit 8d0ea78

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

caso/extract/openstack/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def _get_keystone_session(self):
9292

9393
def _get_keystone_client(self):
9494
"""Get a Keystone Client for the configured project in the object."""
95-
client = keystone_client.get_client(CONF, self.project)
95+
client = keystone_client.get_client(CONF, system_scope="all")
9696
return client
9797

9898
def _get_cinder_client(self):
@@ -126,11 +126,11 @@ def _get_keystone_user(self, uuid):
126126
user = self.keystone.users.get(user=uuid)
127127
return user.name
128128
except keystoneauth1.exceptions.http.Forbidden as e:
129-
LOG.error("Unauthorized to get user")
129+
LOG.error(f"Unauthorized to get user {uuid}")
130130
LOG.exception(e)
131131
return None
132132
except Exception as e:
133-
LOG.debug("Exception while getting user")
133+
LOG.debug(f"Exception while getting user {uuid}")
134134
LOG.exception(e)
135135
return None
136136

doc/source/configuration.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ usages and will fail::
3636
# For each of the projects, add the user with the accounting role
3737
openstack role add --user accounting --project <project> reader
3838

39-
Moreover, if you wish to gather the list of projects that ``cASO`` should use directly
40-
from OpenStack, you need to grant the user the role reader with a system scope of
41-
``all``::
39+
Moreover, you need to grant the user the role reader with a system scope of ``all`` in
40+
order to get all the project tags, as well as the other user's information::
4241

4342
openstack role add --system all --user accounting reader
4443

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
upgrade:
3+
- |
4+
The ``reader`` role with a system scope of ``all`` must be granted to the
5+
``cASO`` user, please check the documentation.
6+
fixes:
7+
- |
8+
* `#108 <https://github.com/IFCA/caso/issues/108>`. Failure getting
9+
accounting data when using different domains.

0 commit comments

Comments
 (0)