Skip to content

Commit

Permalink
improved trash entity handling
Browse files Browse the repository at this point in the history
  • Loading branch information
shayanaijaz committed Nov 22, 2024
1 parent 9b7e8e3 commit 404971f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/portal/libs/agave/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,16 @@ def trash(client, system, path, homeDir, metadata=None):
if err.response.status_code != 404:
logger.error(f'Unexpected exception listing .trash path in {system}')
raise
trash_entity = create_entity_metadata(system, constants.TRASH, {})
add_node_to_project(system, 'NODE_ROOT', trash_entity.uuid, trash_entity.name, settings.TAPIS_DEFAULT_TRASH_NAME)
mkdir(client, system, homeDir, settings.TAPIS_DEFAULT_TRASH_NAME)

try:
trash_entity = get_entity(system, f'{settings.TAPIS_DEFAULT_TRASH_NAME}')
if not trash_entity:
new_entity = create_entity_metadata(system, constants.TRASH, {})
add_node_to_project(system, 'NODE_ROOT', new_entity.uuid, new_entity.name, settings.TAPIS_DEFAULT_TRASH_NAME)
except Exception as e:
print(f'Error creating trash entity: {e}')

resp = move(client, system, path, system,
f'{homeDir}/{settings.TAPIS_DEFAULT_TRASH_NAME}', file_name, metadata)

Expand Down

0 comments on commit 404971f

Please sign in to comment.