Skip to content

Several bugfixes#174

Merged
alvarolopez merged 5 commits intomasterfrom
fixes
Feb 11, 2026
Merged

Several bugfixes#174
alvarolopez merged 5 commits intomasterfrom
fixes

Conversation

@alvarolopez
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings February 6, 2026 10:50
@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

❌ Patch coverage is 61.05263% with 37 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@69881f7). Learn more about missing BASE report.

Files with missing lines Patch % Lines
caso/messenger/greendigit_cim.py 0.00% 26 Missing ⚠️
caso/extract/prometheus.py 86.36% 6 Missing and 3 partials ⚠️
caso/extract/openstack/base.py 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master     #174   +/-   ##
=========================================
  Coverage          ?   58.52%           
=========================================
  Files             ?       25           
  Lines             ?     1401           
  Branches          ?      136           
=========================================
  Hits              ?      820           
  Misses            ?      559           
  Partials          ?       22           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses OpenStack authentication/authorization issues by introducing an unscoped Keystone client with system-level permissions. The main change enables querying user information across projects, which may fail when using project-scoped tokens due to OpenStack's permission model.

Changes:

  • Added keystone_unscoped client attribute to BaseOpenStackExtractor for system-scoped authentication
  • Modified _get_keystone_client method to support both project-scoped and unscoped clients via a project_scoped parameter
  • Updated _get_keystone_user to use the unscoped client for retrieving user information

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 58 to +131
@@ -90,10 +91,12 @@ 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 +128,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)
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new keystone_unscoped client attribute and its usage in _get_keystone_user lack test coverage. While the existing tests mock BaseOpenStackExtractor.__init__ (which prevents breaking existing tests), consider adding tests that verify:

  1. The unscoped client is created with project=None and system_scope="all"
  2. The _get_keystone_user method correctly uses the unscoped client to fetch user information
  3. Error handling works as expected when the unscoped client lacks permissions

This is important because the change addresses what appears to be an OpenStack permissions issue that should be validated through testing.

Copilot uses AI. Check for mistakes.
"""Get the Keystone username for a given uuid."""
try:
user = self.keystone.users.get(user=uuid)
user = self.keystone_unscoped.users.get(user=uuid)
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a comment explaining why an unscoped Keystone client is needed here. The change from using self.keystone to self.keystone_unscoped suggests this addresses an OpenStack permissions issue where project-scoped tokens may not have permission to query user information. A brief comment would help future maintainers understand the reasoning, for example:

"Use unscoped client with system scope to query user information, as project-scoped tokens may lack permissions to access users across all projects."

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link

@alvarolopez alvarolopez enabled auto-merge (rebase) February 11, 2026 10:54
@alvarolopez alvarolopez disabled auto-merge February 11, 2026 10:54
@alvarolopez alvarolopez merged commit d73a579 into master Feb 11, 2026
14 checks passed
@alvarolopez alvarolopez deleted the fixes branch February 11, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants