list with multiple repositories & json #155

Closed
opened 2019-03-25 08:12:09 +00:00 by setiseta · 4 comments

I have a configuration where there is a default job in /etc/borgmatic/config.yaml which uses one repo, and a little application job in /etc/borgmatic.d/app1.yaml

if I now use borgmatic --list --json or even just for one repo borgmatic --list --json --repository REPO1 i get following error:
Error:Multiple JSON root elements[Code 22, Structure 240]

in the second case there is only a [] appended after the json from repository 1

I have a configuration where there is a default job in /etc/borgmatic/config.yaml which uses one repo, and a little application job in /etc/borgmatic.d/app1.yaml if I now use `borgmatic --list --json` or even just for one repo `borgmatic --list --json --repository REPO1` i get following error: Error:Multiple JSON root elements[Code 22, Structure 240] in the second case there is only a `[]` appended after the json from repository 1
Owner

I wasn't able to reproduce this problem with a similar set up. What version of borgmatic are you using? (borgmatic --version or pip3 show borgmatic) Also, posting your borgmatic config files (with sensitive information redacted) may be helpful. Thanks!

I wasn't able to reproduce this problem with a similar set up. What version of borgmatic are you using? (`borgmatic --version` or `pip3 show borgmatic`) Also, posting your borgmatic config files (with sensitive information redacted) may be helpful. Thanks!
Author

thanks for your feedback.
i have added everything i think is needed. tell me if something is missing.

#borgmatic --version
1.3.0

file: /etc/borgmatic/config.yaml

location:
    source_directories:
        - /home
        - /etc
        - /pool
        - /root
        - /var/log
    repositories:
        - /mnt/Backup/server
storage:
    compression: lz4
retention:
    keep_daily: 30
    keep_weekly: 8
    keep_monthly: 6
hooks:
    before_backup:
        - echo "Starting a backup job."
    after_backup:
        - echo "Backup created."
    on_error:
        - echo "Error while creating a backup."

file: /etc/borgmatic.d/app1.yaml

location:
    source_directories:
        - /mnt/app1
    repositories:
        - /mnt/Backup/app1
storage:
    compression: lz4
    archive_name_format: 'app1-{now}'
retention:
    keep_daily: 30
    keep_weekly: 8
    keep_monthly: 6
    prefix: app1
consistency:
    prefix: app1
hooks:
    before_backup:
        - echo "Starting a backup job."
    after_backup:
        - echo "Backup created."
    on_error:
        - echo "Error while creating a backup."

the list command:
borgmatic --list --repository /mnt/Backup/app1 --json
output:

[][{"archives": [{"archive": "app1-2019-03-25T15:33:39", "barchive": "app1-2019-03-25T15:33:39", "id": "b57d5bdbc1731e49e35eda4e7e974711ac2e76cb5abf34d9b329cb8ba6b17666", "name": "app1-2019-03-25T15:33:39", "start": "2019-03-25T15:33:40.000000", "time": "2019-03-25T15:33:40.000000"}, {"archive": "app1-2019-03-26T03:05:27", "barchive": "app1-2019-03-26T03:05:27", "id": "445ad81ce3d93e401cb39d318826d3a648aca4e01b2ae2b382b615bba6c3d0a4", "name": "app1-2019-03-26T03:05:27", "start": "2019-03-26T03:05:28.000000", "time": "2019-03-26T03:05:28.000000"}], "encryption": {"mode": "repokey"}, "repository": {"id": "df39d962fcb0e4aaca11c868c4c99ef4ff555551e38893ecf484c0a758d10609", "last_modified": "2019-03-26T03:46:44.000000", "location": "/mnt/Backup/app1"}}]

You see the first two characters are [] i think from the other repository, which is not selected.
but if i use this output in an application, or just in a online json beautifier it gives an error.
for example here:
https://jsonformatter.curiousconcept.com/
Error:Multiple JSON root elements[Code 22, Structure 3]

thanks for your feedback. i have added everything i think is needed. tell me if something is missing. ``` #borgmatic --version 1.3.0 ``` file: `/etc/borgmatic/config.yaml` ``` location: source_directories: - /home - /etc - /pool - /root - /var/log repositories: - /mnt/Backup/server storage: compression: lz4 retention: keep_daily: 30 keep_weekly: 8 keep_monthly: 6 hooks: before_backup: - echo "Starting a backup job." after_backup: - echo "Backup created." on_error: - echo "Error while creating a backup." ``` file: `/etc/borgmatic.d/app1.yaml` ``` location: source_directories: - /mnt/app1 repositories: - /mnt/Backup/app1 storage: compression: lz4 archive_name_format: 'app1-{now}' retention: keep_daily: 30 keep_weekly: 8 keep_monthly: 6 prefix: app1 consistency: prefix: app1 hooks: before_backup: - echo "Starting a backup job." after_backup: - echo "Backup created." on_error: - echo "Error while creating a backup." ``` the list command: `borgmatic --list --repository /mnt/Backup/app1 --json` output: ``` [][{"archives": [{"archive": "app1-2019-03-25T15:33:39", "barchive": "app1-2019-03-25T15:33:39", "id": "b57d5bdbc1731e49e35eda4e7e974711ac2e76cb5abf34d9b329cb8ba6b17666", "name": "app1-2019-03-25T15:33:39", "start": "2019-03-25T15:33:40.000000", "time": "2019-03-25T15:33:40.000000"}, {"archive": "app1-2019-03-26T03:05:27", "barchive": "app1-2019-03-26T03:05:27", "id": "445ad81ce3d93e401cb39d318826d3a648aca4e01b2ae2b382b615bba6c3d0a4", "name": "app1-2019-03-26T03:05:27", "start": "2019-03-26T03:05:28.000000", "time": "2019-03-26T03:05:28.000000"}], "encryption": {"mode": "repokey"}, "repository": {"id": "df39d962fcb0e4aaca11c868c4c99ef4ff555551e38893ecf484c0a758d10609", "last_modified": "2019-03-26T03:46:44.000000", "location": "/mnt/Backup/app1"}}] ``` You see the first two characters are `[]` i think from the other repository, which is not selected. but if i use this output in an application, or just in a online json beautifier it gives an error. for example here: https://jsonformatter.curiousconcept.com/ `Error:Multiple JSON root elements[Code 22, Structure 3]`
Owner

Thanks for the detailed info! Based on that, I did manage to get a local repro of the problem. Now to see about a fix...

Thanks for the detailed info! Based on that, I did manage to get a local repro of the problem. Now to see about a fix...
witten added the
bug
label 2019-04-01 22:38:48 +00:00
Owner

Okay, this is now fixed in borgmatic 1.3.1, just released. Please let me know if you have any other issues with the JSON output.

Okay, this is now fixed in borgmatic 1.3.1, just released. Please let me know if you have any other issues with the JSON output.
Sign in to join this conversation.
No Milestone
No Assignees
2 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#155
No description provided.