summaryrefslogtreecommitdiffstats
path: root/lib/App/BorgRestore
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2023-09-03 13:50:27 +0200
committerFlorian Pritz <bluewind@xinu.at>2023-09-03 13:50:27 +0200
commit7d6d3eab0db08f6905c90061cacb2b26c42949f2 (patch)
tree7c5eb29ea1ac3dd139b64a41e3e5f87d8d5505ba /lib/App/BorgRestore
parent972c3e21bd645376dc4544d6339f2c125e43d668 (diff)
downloadApp-BorgRestore-7d6d3eab0db08f6905c90061cacb2b26c42949f2.tar.gz
App-BorgRestore-7d6d3eab0db08f6905c90061cacb2b26c42949f2.tar.xz
Fix deprecation warning with borg 1.2.x
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App/BorgRestore')
-rw-r--r--lib/App/BorgRestore/Borg.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/App/BorgRestore/Borg.pm b/lib/App/BorgRestore/Borg.pm
index 04ad89c..9884b21 100644
--- a/lib/App/BorgRestore/Borg.pm
+++ b/lib/App/BorgRestore/Borg.pm
@@ -55,7 +55,14 @@ method borg_list() {
my @archives;
my $backup_prefix = $self->{backup_prefix};
- if (Version::Compare::version_compare($self->{borg_version}, "1.1") >= 0) {
+ if (Version::Compare::version_compare($self->{borg_version}, "1.2") >= 0) {
+ $log->debug("Getting archive list via json");
+ run [qw(borg list --glob-archives), "$backup_prefix*", qw(--json), $self->{borg_repo}], '>', \my $output or die $log->error("borg list returned $?")."\n";
+ my $json = decode_json($output);
+ for my $archive (@{$json->{archives}}) {
+ push @archives, $archive->{archive};
+ }
+ } elsif (Version::Compare::version_compare($self->{borg_version}, "1.1") >= 0) {
$log->debug("Getting archive list via json");
run [qw(borg list --prefix), $backup_prefix, qw(--json), $self->{borg_repo}], '>', \my $output or die $log->error("borg list returned $?")."\n";
my $json = decode_json($output);