-
Notifications
You must be signed in to change notification settings - Fork 5
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
BUG: allow server query with non-admin credentials #152
BUG: allow server query with non-admin credentials #152
Conversation
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #152 +/- ##
==========================================
+ Coverage 97.28% 97.32% +0.03%
==========================================
Files 149 149
Lines 6479 6500 +21
Branches 420 420
==========================================
+ Hits 6303 6326 +23
+ Misses 143 142 -1
+ Partials 33 32 -1
☔ View full report in Codecov by Sentry. |
d2f870d
to
c102710
Compare
raise ParseQueryError( | ||
"This query uses a preset that requires searching on project_ids " | ||
"- but you've provided projects to search in using from_projects meta param" | ||
"- please use one or the other, not both" | ||
"- or you are not running as admin" |
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.
I don't think this applies in this case? Since the exception only applies to the query lib and how the user sets the flag regardless of their cred status
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.
quirk of how it works basically
if a user tries to run a query where they are trying to filter by project id and they are not admin - run_query() will be run with both a meta-param auto-generated which contains one project (the one that is scoped to the project) and filter kwargs set by the user - then we will hit the error
now parse-meta-params will default to only searching in currently scoped project-id unless as_admin flag given
c102710
to
357d8e2
Compare
357d8e2
to
3f11195
Compare
This PR changes the way server-query works
Now, by default - a server query will use the current scoped project - set in clouds.yaml if no meta-params given
To run admin-level queries - i.e. those which require accessing projects other than the preset one in clouds.yaml - an extra meta-param is required
as_admin=True
To run a query on all projects - a meta-param is required
all_projects=True
alongsideas_admin=True
To run a query on select projects - a meta-param is required
from_projects=[]
alongsideas_admin=True
If neither of these meta-params is given and
as_admin=True
is set - the query will run on all projects that the user - scoped in clouds.yaml has access to.Also changes mapping for server_status to
status
and notvm_state
so now we can useSHUTOFF
instead ofSTOPPED