-
Notifications
You must be signed in to change notification settings - Fork 17
Several bugfixes #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Several bugfixes #174
Changes from all commits
96241ba
87fe46f
b34b11d
0b5b1d9
dfde810
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,7 @@ def __init__(self, project, vo): | |
| super(BaseOpenStackExtractor, self).__init__(project) | ||
|
|
||
| self.keystone = self._get_keystone_client() | ||
| self.keystone_unscoped = self._get_keystone_client(project_scoped=False) | ||
| self.project_id = self._get_project_id() | ||
|
|
||
| self.vo = vo | ||
|
|
@@ -90,10 +91,10 @@ def _get_keystone_session(self): | |
| session = keystone_client.get_session(CONF, self.project) | ||
| return session | ||
|
|
||
| def _get_keystone_client(self): | ||
| def _get_keystone_client(self, project_scoped=True): | ||
| """Get a Keystone Client for the configured project in the object.""" | ||
| client = keystone_client.get_client( | ||
| CONF, project=self.project, system_scope="all" | ||
| CONF, project=self.project if project_scoped else None, system_scope="all" | ||
| ) | ||
| return client | ||
|
|
||
|
|
@@ -125,7 +126,7 @@ def _get_project_id(self): | |
| def _get_keystone_user(self, uuid): | ||
| """Get the Keystone username for a given uuid.""" | ||
| try: | ||
| user = self.keystone.users.get(user=uuid) | ||
| user = self.keystone_unscoped.users.get(user=uuid) | ||
|
||
| return user.name | ||
| except keystoneauth1.exceptions.http.Forbidden as e: | ||
| LOG.error(f"Unauthorized to get user {uuid}") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
keystone_unscopedclient attribute and its usage in_get_keystone_userlack test coverage. While the existing tests mockBaseOpenStackExtractor.__init__(which prevents breaking existing tests), consider adding tests that verify:project=Noneandsystem_scope="all"_get_keystone_usermethod correctly uses the unscoped client to fetch user informationThis is important because the change addresses what appears to be an OpenStack permissions issue that should be validated through testing.