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

task/WG-182: adding additional logging for project uuid upon deletion #163

Merged
merged 3 commits into from
Nov 30, 2023

Conversation

tjgrafft
Copy link
Contributor

@tjgrafft tjgrafft commented Nov 29, 2023

Overview:

Improve logging of delete to include UUID with project ID. See notes of the related WG-70 issue of why this is needed.

In https://github.com/TACC-cloud/geoapi
in geoapi/routes/projects.py

Related Jira tickets:

Summary of Changes:

  • Improved logging of delete to include UUID

Testing Steps:

  1. Navigate to geoapi repo and run 'make start'
  2. Run this command 'curl -H X-JWT-Assertion-designsafe:$JWT localhost:8000/projects/' to list the current projects
  3. Pick a project that's ok to delete and use its projectid in this next command
  4. curl -X 'DELETE' \
    'http://localhost:8000/projects/1/' \
    -H X-JWT-Assertion-designsafe:$JWT
  5. Should get a 'status': 'ok' response from api
  6. Run this command again 'curl -H X-JWT-Assertion-designsafe:$JWT localhost:8000/projects/'
  7. You shouldn't see the project you deleted in your project listing anymore.
  8. Also go to Docker Desktop and find the 'geoapi' container.
  9. In the logs of that container you should see something like this:

Delete project:1 with UUID:2b097db7-d370-40c5-a632-6ed441ca47a5 for user:tgrafft

  1. Compare with screenshots below

UI:

Screenshot 2023-11-29 at 9 33 08 AM Screenshot 2023-11-29 at 9 33 29 AM Screenshot 2023-11-29 at 9 32 36 AM

Notes:

Copy link
Contributor

@sophia-massie sophia-massie left a comment

Choose a reason for hiding this comment

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

LGTM! Tested locally and see the geoapi log as expected. Thanks!

Copy link
Collaborator

@nathanfranklin nathanfranklin left a comment

Choose a reason for hiding this comment

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

Looks good 👍 Left two comments to consider

Comment on lines 218 to 219
else:
abort(404, "Project not found")
Copy link
Collaborator

Choose a reason for hiding this comment

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

good thought on adding a check related to the project not being found. but it can be dropped in this instance as the project_admin_or_creator_permissions decorator has that logic in a check_access_and_get_project method that it calls.

project = ProjectsService.get(db_session, project_id=projectId, user=u)
# Check if the project exists and log the information including the UUID
if project:
logger.info("Delete project:{} with UUID:{} for user:{}".format(
Copy link
Collaborator

Choose a reason for hiding this comment

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

instead of UUID what about project_uuid?

There are lots of uuids in the code for things like task, streetview, asset path etc. so maybe being more specific would improve things.

I got the somewhat related PR #161 where I did something different but I am going to alter that to match what we decide here and the rest of the code.

Seems like the rest of the log statements use project: when referring to the int id 👍 so just what should we call the project uuid.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can change it to "Project UUID:" or "project_uuid:"

Copy link
Collaborator

@nathanfranklin nathanfranklin left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@sophia-massie sophia-massie merged commit c9d5148 into master Nov 30, 2023
3 checks passed
@sophia-massie sophia-massie deleted the task/WG-182-logging-project-uuid branch November 30, 2023 21:23
Copy link
Contributor

@taoteg taoteg left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

4 participants