sinnwerkstatt/runrestic

Broken backup output parsing with Restic 0.14.0

gmag11 opened this issue · 7 comments

I guess Restic output parsing broken again after Restic update to 0.14.0. In this case after backup operation.

Before something similar hapened with prune as #51

This happens with Restic 0.14.0 and RunRestic 0.5.26.1 from pip.

$ restic version
restic 0.14.0 compiled with go1.19 on linux/arm64
$ runrestic -v
runrestic
0.5.26.1
Traceback (most recent call last):
  File "/usr/local/bin/runrestic", line 8, in <module>
    sys.exit(runrestic())
  File "/usr/local/lib/python3.8/dist-packages/runrestic/runrestic/runrestic.py", line 81, in runrestic
    result.append(runner.run())
  File "/usr/local/lib/python3.8/dist-packages/runrestic/restic/runner.py", line 56, in run
    self.backup()
  File "/usr/local/lib/python3.8/dist-packages/runrestic/restic/runner.py", line 143, in backup
    metrics[redact_password(repo, self.pw_replacement)] = parse_backup(
  File "/usr/local/lib/python3.8/dist-packages/runrestic/restic/output_parsing.py", line 19, in parse_backup
    added_to_the_repo = re.findall(
IndexError: list index out of range

Of course, this is fixed by downgrading Restic to 0.13.1: https://github.com/restic/restic/releases/tag/v0.13.1

So not an urgent issue

Hi @andreasnuesslein , I think we should make the output parsing more robust against such changes by adding some exception handling. I have already tried this (see https://github.com/palto42/runrestic/blob/fix_output_parsing/runrestic/restic/output_parsing.py) and can provide a PR after some more testing.
It might be required to add some dummy output if the parsing fails in order to serve the metrics feature.

Hi @gmag11 , I'm using restic 0.14.0 since 04. September with runrestic 0.5.26.1 and have no such issue, so not fully sure why it happens for you but not for me.

I installed runrestic from pip. Using older restic 0.13 worked fine. I'll try again and report here the results

I've run it in a fresh new Ubuntu 22.04. With same result. Restic 0.14.0, Runrestic 0.5.26.1. Turning back to Restic 0.13.1 solves the issue.

Hi @gmag11 , I now found the reason why runrestic 0.5.26.1 works for me with restic 0.14 but not for you: I installed runrestic from git and not from PyPI.
The version git has the fix for restic 0.14 but the version number wasn't incremented. The commit with the fix was merged on 11. September and the PyPI package already pushed on 26. August. On 26. August there was a commit which just bumped the version to 0.26.1 without actual code changes, but the commit message said "version bump for fix",

@andreasnuesslein Please rebuild the package with the fix and update it on PyPI.

Thanks for investigating @palto42

I merged the update to https://github.com/sinnwerkstatt/runrestic/tree/0.5.27 and pushed the package to PyPI.

@gmag11 you should be able to upgrade runrestic to 0.5.27 now via pypi. please report back and/or close the issue if it's solved

Working perfectly. Thanks!