Restore actions cannot find the repository when its path is relative #691

Closed
opened 2023-05-08 04:16:51 +00:00 by witten · 2 comments
Owner

What I'm trying to do and why

I'm trying to restore a database dump as part of manual testing a separate feature.

Steps to reproduce

  1. Create a configuration file (test.yaml) with a repository that has a relative path, say in the current directory. Also configure a database in the configuration file.
  2. Run borgmatic create -c test.yaml to create an archive containing a database dump.
  3. Run borgmatic -c test.yaml -v 2 restore --archive latest to attempt to restore that dump.

Actual behavior

...
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/borg/archiver.py", line 5213, in main
    exit_code = archiver.run(args)
  File "/usr/lib/python3.10/site-packages/borg/archiver.py", line 5144, in run
    return set_ec(func(args))
  File "/usr/lib/python3.10/site-packages/borg/archiver.py", line 168, in wrapper
    with repository:
  File "/usr/lib/python3.10/site-packages/borg/repository.py", line 200, in __enter__
    self.open(self.path, bool(self.exclusive), lock_wait=self.lock_wait, lock=self.do_lock)
  File "/usr/lib/python3.10/site-packages/borg/repository.py", line 428, in open
    raise self.DoesNotExist(path)
borg.repository.Repository.DoesNotExist: Repository /1.2.borg does not exist.
...

Expected behavior

Successful database restore.

Other notes / implementation ideas

This bug does not manifest when the repository path is absolute. That's likely because the working directory change in borgmatic/borg/extract.py only causes issues when the repository path is relative.

Environment

borgmatic version: main

borgmatic installation method: pip install --editable

Borg version: 1.2.4

Python version: 3.10.10

Database version: PostgreSQL 14.3

operating system and version: Manjaro Linux stable

#### What I'm trying to do and why I'm trying to restore a database dump as part of manual testing a separate feature. #### Steps to reproduce 1. Create a configuration file (`test.yaml`) with a repository that has a relative path, say in the current directory. Also configure a database in the configuration file. 2. Run `borgmatic create -c test.yaml` to create an archive containing a database dump. 3. Run `borgmatic -c test.yaml -v 2 restore --archive latest` to attempt to restore that dump. #### Actual behavior ```python ... Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/borg/archiver.py", line 5213, in main exit_code = archiver.run(args) File "/usr/lib/python3.10/site-packages/borg/archiver.py", line 5144, in run return set_ec(func(args)) File "/usr/lib/python3.10/site-packages/borg/archiver.py", line 168, in wrapper with repository: File "/usr/lib/python3.10/site-packages/borg/repository.py", line 200, in __enter__ self.open(self.path, bool(self.exclusive), lock_wait=self.lock_wait, lock=self.do_lock) File "/usr/lib/python3.10/site-packages/borg/repository.py", line 428, in open raise self.DoesNotExist(path) borg.repository.Repository.DoesNotExist: Repository /1.2.borg does not exist. ... ``` #### Expected behavior Successful database restore. #### Other notes / implementation ideas This bug does not manifest when the repository path is absolute. That's likely because the working directory change in `borgmatic/borg/extract.py` only causes issues when the repository path is relative. #### Environment **borgmatic version:** main **borgmatic installation method:** `pip install --editable` **Borg version:** 1.2.4 **Python version:** 3.10.10 **Database version:** PostgreSQL 14.3 **operating system and version:** Manjaro Linux stable
witten added the
bug
label 2023-05-08 04:16:51 +00:00
Author
Owner

Fixed in main.

Fixed in main.
Author
Owner

This was just released in borgmatic 1.7.13!

This was just released in borgmatic 1.7.13!
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#691
No description provided.