KenKundert / emborg

Interactive command line interface to Borg Backup
GNU General Public License v3.0
94 stars 8 forks source link

compact_after_delete generates error #62

Closed adhawkins closed 2 years ago

adhawkins commented 2 years ago

If I specify compact_after_delete in my config, I get an error:

xcp-alpine-emborg:~# emborg -c paperless-test prune --list --stats

Running Borg prune command ...
Keeping archive (rule: daily #1):        2022-03-28-21-44-28                  Mon, 2022-03-28 21:44:30 [b6c68cce3d2934d1fbfc4255a01174fd8101527018a0f92b3f9d49fa4351a96c]
------------------------------------------------------------------------------
                       Original size      Compressed size    Deduplicated size
Deleted data:                    0 B                  0 B                  0 B
All archives:              406.16 MB            356.62 MB            355.94 MB

                       Unique chunks         Total chunks
Chunk index:                    1689                 1692
------------------------------------------------------------------------------
Usage:
    emborg compact [options]

If I specifically run compact, it seems to work Ok:

xcp-alpine-emborg:~# emborg -c paperless-test compact -p

Running Borg compact command ...
xcp-alpine-emborg:~#
KenKundert commented 2 years ago

Thanks Andy. I have fixed the bug and checked the code into GitHub. Please try it out and let me know if I missed anything.

adhawkins commented 2 years ago

I've installed using pip on an extracted ZIP file of the main branch.

Prune now seems to work, but delete still displays an error:

xcp-alpine-emborg:~# /home/andy/.local/bin/emborg -c paperless-test prune
xcp-alpine-emborg:~# /home/andy/.local/bin/emborg -c paperless-test delete 2022-
03-29-09-22-51
Usage:
    emborg compact [options]

which is odd, because I only thought to test the delete because I saw you'd made the same code change there!

KenKundert commented 2 years ago

That is strange. I had checked in a version that did not have the fix for delete, only prune. Perhaps you still have that version. Please check line 836 in emborg/command.py. It should look like this:

                compact_status = compact.run("compact", [], settings, options)

Specifically, it has [] as the second argument to run, whereas previously it was args. If it still says args try upgrading your repository.

adhawkins commented 2 years ago

My version does have that. I wonder if the 'local' install is being overridden by the master install I have? Will try removing the packaged version.

Yep, that was it. My mistake. Apologies! Consider this closed.

KenKundert commented 2 years ago

Okay, I am now working to refine the tests a bit. Previously I added a environment variable to allow me to skip tests that required fuse if fuse was not available. The way I did it was is not considered a best practice for pytest, so I am reworking the missing dependencies feature. When I am done it will also all you to specify --no-fuse or --borg-version to the pytest command line to allow you to suppress tests that require either fuse or a particular borg version. When that is done I will update pypi.

KenKundert commented 2 years ago

I have updated the version to 1.32 and pushed it to pypi.