-
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
DT-1217: Python script to remove a user from a list of snapshots #1901
base: develop
Are you sure you want to change the base?
Conversation
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.
This seems very reasonable to me
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.
Looks OK, just some minor comments
for snapshot_id in snapshot_ids: | ||
print(f"Removing from {snapshot_id}") | ||
result = clients.snapshots_api.delete_snapshot_policy_member(snapshot_id, role, email) | ||
print(result) |
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.
Should this validate the result? If there are a lot of IDs, maybe only print the ones that failed?
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.
Good point. I updated the error messaging.
On success:
Removing <email> as steward from 1 snapshots
DONE. Successfully removed 1 members from 1 snapshots. 0 failed.
On failure:
Removing <email> as steward from 1 snapshots
Error: Could not remove <email> from 733dcfa4-1bd6-4c58-a9e5-8dd224d3ce9f; Exception: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({<redacted>)
HTTP response body: {"message":"<email> not found","errorDetail":[]}
DONE. Successfully removed 0 members from 1 snapshots. 1 failed.
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.
Looks good. I agree with Phil's suggestion about logging.
|
Jira ticket: https://broadworkbench.atlassian.net/browse/DT-1217
Addresses
As we try to help unblock users stuck with too many google groups, it can be helpful to remove a single user/group from a bunch of snapshots. We have been asked to do this twice in the last month so it is probably worth committing this script to our repo.
Summary of changes
Testing Strategy