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

Archive 'delete' action allowed via context menu during background operations #1792

Closed
bigtedde opened this issue Aug 31, 2023 · 2 comments
Closed

Comments

@bigtedde
Copy link
Collaborator

bigtedde commented Aug 31, 2023

Description

When testing the archive tab context menu, I found the "delete" action is allowed via the context menu, even when it is disabled due to an ongoing background operation. This can lead to out of bound exceptions if the same archive is deleted twice, as show below:

delete_issue

Reproduction steps:

  1. Open Vorta and navigate tot he Archive tab
  2. Select the first archive, and click 'delete'. Confirm that you wish to delete.
  3. While the archive delete action is occurring, observe that the delete button is now disabled.
  4. While the archive delete action is occurring, right click the archive being deleted and observe that the delete action is available via this menu.
  5. While the archive delete action is occurring, right click the archive being deleted and select "delete". Confirm that you wish to delete.
  6. Wait for archive delete actions to complete
  7. Observe that an out of bounds exception has occurred, causes by attempting to delete an archive that no longer exists.

Environment

  • OS: Mac OS Ventura 13.5.1
  • Vorta version: 0.9.0
  • Installed from: Source
  • Borg version: 1.2.4

Logs

023-08-31 13:42:56,458 - vorta.borg.borg_job - INFO - Running command /opt/homebrew/bin/borg delete --info --log-json ssh://vwxe9eus@vwxe9eus.repo.borgbase.com/./repo::This is archive 6
2023-08-31 13:42:56,626 - root - CRITICAL - Uncaught exception, file a report at https://github.com/borgbase/vorta/issues/new/choose
Traceback (most recent call last):
  File "/Users/ted/Desktop/vorta_workspace/vorta/env/lib/python3.11/site-packages/peewee.py", line 7117, in get
    return clone.execute(database)[0]
           ~~~~~~~~~~~~~~~~~~~~~~~^^^
  File "/Users/ted/Desktop/vorta_workspace/vorta/env/lib/python3.11/site-packages/peewee.py", line 4481, in __getitem__
    return self.row_cache[item]
           ~~~~~~~~~~~~~~^^^^^^
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ted/Desktop/vorta_workspace/vorta/src/vorta/views/archive_tab.py", line 945, in delete_result
    ArchiveModel.get(name=archive).delete_instance()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ted/Desktop/vorta_workspace/vorta/env/lib/python3.11/site-packages/peewee.py", line 6669, in get
    return sq.get()
           ^^^^^^^^
  File "/Users/ted/Desktop/vorta_workspace/vorta/env/lib/python3.11/site-packages/peewee.py", line 7120, in get
    raise self.model.DoesNotExist('%s instance matching query does '
vorta.store.models.ArchiveModelDoesNotExist: <Model: ArchiveModel> instance matching query does not exist:
SQL: SELECT "t1"."id", "t1"."snapshot_id", "t1"."name", "t1"."repo_id", "t1"."time", "t1"."duration", "t1"."size", "t1"."trigger" FROM "archivemodel" AS "t1" WHERE ("t1"."name" = ?) LIMIT ? OFFSET ?
Params: ['This is archive 6', 1, 0]
2023-08-31 13:43:00,010 - vorta.borg.borg_job - WARNING - Archive This is archive 6 not found (1/1).
2023-08-31 13:43:00,536 - vorta.borg.jobs_manager - DEBUG - Finish job for site: 1
2023-08-31 13:43:00,537 - vorta.borg.jobs_manager - DEBUG - No more jobs for site: 1
@bigtedde
Copy link
Collaborator Author

I can fix this issue. The 'delete' action added to the context menu just needs to mimic the "enabled" state of the 'delete' button.

@bigtedde
Copy link
Collaborator Author

bigtedde commented Sep 1, 2023

More broadly: I am seeing there is no direct connection between the buttons being toggled off in the archive tab vs the buttons being toggled in the context menu.

I think the best approach will be to link these buttons, as I can't think of a time or reason when an action should be available in the context menu when the corresponding button is disabled. Am I overlooking anything here?

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

No branches or pull requests

1 participant