From 31ce14e4c2ca3e60ea5b185aa85508bb60d3a1f3 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Tue, 22 Feb 2022 20:28:01 +0100 Subject: [PATCH] btrbk: handle errors from btrfs filesystem usage Fix `btrbk usage` unhandled error case if usage data cannot be retrieved, e.g.: ERROR: Failed to fetch btrfs filesystem usage for: example.com:/mnt/btr_pool ERROR: ... sh: ssh -i 'XXX' btrbk@example.com 'btrfs-filesystem-usage '\''/mnt/btr_pool'\''' ERROR: ... cannot access '/mnt/btr_pool': Permission denied --- btrbk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btrbk b/btrbk index c428909..cbea113 100755 --- a/btrbk +++ b/btrbk @@ -6439,7 +6439,7 @@ MAIN: return unless($mountpoint); my $mount_source = $mountpoint->{mount_source}; my $mid = $vol->{MACHINE_ID} . $mount_source; - $usage_cache{$mid} //= btrfs_filesystem_usage($vol); + $usage_cache{$mid} //= btrfs_filesystem_usage($vol) // {}; push @data, { %{$usage_cache{$mid}}, type => $type, mount_source => $mount_source,