Skip to content
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

No admin #126

Closed
Closed

Conversation

alvarolopez
Copy link
Member

(shamelessly taken from #123 as this could not be reopened)

Description

Avoid issues when running cASO with a low privileges account that cannot
list all projects and scope the tokens to the projects that are to be
accounted. This allows to run cASO and generate records for non-admin
users.

Fixes #124

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details for
your test configuration

  • Test caso-extract using v3oidcaccesstoken authentication with an EGI Check-in access token in 2 projects at IFCA-LCG2. Configuration:
    [DEFAULT]
    spooldir = var/spool/caso
    site_name = IFCA-LCG2
    projects = 999f045cb1ff4684a15ebb338af69460, 5eb8959a799240a98f4f303f5fbd80be
    [accelerator]
    [benchmark]
    [keystone_auth]
    auth_type = v3oidcaccesstoken
    auth_url = https://api.cloud.ifca.es:5000/v3
    project_id = 999f045cb1ff4684a15ebb338af69460
    identity_provider = egi.eu
    protocol = openid
    access_token = XXX-redacted
    [logstash]
    [sample_remote_file_source]
    [ssm]
    

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@alvarolopez
Copy link
Member Author

@enolfc can you remove the second commit? This is not needed anymore.

project = self.keystone.projects.get(project_id)
except (EmptyCatalog, Forbidden):
# we may need scoping here, retrying
LOG.warning(f"Scoping the keystone client to the current project {project_id}")
Copy link
Member Author

Choose a reason for hiding this comment

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

This will make flake8 complain

client = keystone_client.get_client(CONF, system_scope="all")
if project:
system_scope = None
client = keystone_client.get_client(CONF,
Copy link
Member Author

Choose a reason for hiding this comment

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

This will make black unhappy

@@ -92,7 +92,7 @@ def _get_keystone_session(self):

def _get_keystone_client(self):
"""Get a Keystone Client for the configured project in the object."""
client = keystone_client.get_client(CONF, system_scope="all")
client = keystone_client.get_client(CONF, project=self.project, system_scope="all")
Copy link
Member Author

Choose a reason for hiding this comment

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

This will make flake8 cry

Avoid issues when running cASO with a low privileges account that cannot
list all projects and scope the tokens to the projects that are to be
accounted. This allows to run cASO and generate records for non-admin
users.
@enolfc
Copy link

enolfc commented Sep 29, 2023

Fixed linter issues. Coverage still fails

@alvarolopez alvarolopez force-pushed the pydantic2 branch 2 times, most recently from 731c2ed to fc85fad Compare September 27, 2024 10:20
@alvarolopez alvarolopez deleted the branch IFCA-Advanced-Computing:pydantic2 September 27, 2024 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants