Open najose opened 10 months ago
@wolfv, So the above mentioned issue was an error from my side. The persistent volume had the old config, so creating a deployment with --exists-ok
must've skipped bringing in the new changes to the configs.
Once I fixed this, I was able to test all the other features as well. I have made some changes but I couldn't push as I don't have write access, so I've added diffs of the changes I made below.
Google IAP proxy middleware:
server_admin_emails
seems like it needs the below fix to compare user email instead of a userid:Soft Delete: This is working as expected for both packages and channels once I made a few changes regarding config.
I had to make a few fixes to get this to work
Package promotion: I couldn't get this to work, whenever I tried to copy a package it seems to fail with below stack trace in the server logs:
Thanks, fixed the first issue like you did (and pushed to both testing
and the feature branch). Now going to work on the second issue – will also fix up all the tests today.
@najose I've fixed two additional issues I've encountered for the copying. Maybe you can test with the latest state again :)
quick note that I implemented the feature you asked for re. skipping the authorization for health endpoints.
@wolfv, Thanks will test it out soon.
@wolfv, I tested out the latest changes (fix for copying packages, health check with no authN) from the testing
branch, the changes are all working as expected.
You seem to have missed one fix for handling server_admin_emails
. The current logic seems to be looking at an integer user id in a server_admin_emails
list which is supposed to contain a list of emails.
diff --git a/plugins/quetz_googleiap/quetz_googleiap/middleware.py b/plugins/quetz_googleiap/quetz_googleiap/middleware.py
index 71e05c5..cd18b80 100644
--- a/plugins/quetz_googleiap/quetz_googleiap/middleware.py
+++ b/plugins/quetz_googleiap/quetz_googleiap/middleware.py
@@ -91,7 +91,7 @@ class GoogleIAMMiddleware(BaseHTTPMiddleware):
)
dao.create_channel(channel, user.id, "owner")
- self.google_role_for_user(user_id, dao)
+ self.google_role_for_user(user_id, email, dao)
user_id = uuid.UUID(bytes=user.id)
# drop the db and dao to remove the connection
del db, dao
@@ -105,15 +105,15 @@ class GoogleIAMMiddleware(BaseHTTPMiddleware):
response = await call_next(request)
return response
- def google_role_for_user(self, user_id, dao):
- if not user_id:
+ def google_role_for_user(self, user_id, username, dao):
+ if not user_id or not username:
return
- if user_id in self.server_admin_emails:
- logger.info(f"User {user_id} is server admin")
+ if username in self.server_admin_emails:
+ logger.info(f"User '{username}' with user id '{user_id}' is server admin")
dao.set_user_role(user_id, "owner")
else:
- logger.info(f"User {user_id} is not a server admin")
+ logger.info(f"User '{username}' with user id '{user_id}' is not a server admin")
dao.set_user_role(user_id, "member")
@wolfv I have tried testing testing the changes in https://github.com/wolfv/quetz/tree/testing and noted my observations below.
Observations
[googleiam]
section is not configured in the config.toml. But in my testing the section is present in the config. On adding more debug statements into the code, it seems callingconfig.configured_section('googleiam)
callsconfig.get('googleiam')
and this fails with the same error message as the ones seen in the annotated test failures in this PR workflow run - (AttributeError: 'super' object has no attribute 'getattr'). Also "Google IAM is not configured" seems to be raised in the test failure annotations for IAP middleware PRTesting environment
I have a built docker image using the below dockerfile and pushed it a publically accessible registry in case you want to inspect the image I'm using.
Image name:
us-east1-docker.pkg.dev/package-factory-sandbox/quetz-sdgr/quetz-testing:latest
The container startup script creates a deployment and starts Quetz:
Config
I'll add more observations in the GitHub issue as and when I find them. Please let me know when I can test again with the issues resolved in the testing branch.