]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage/Plugin.pm
fix prune-backups validation (again)
[pve-storage.git] / PVE / Storage / Plugin.pm
index b1865cb2c58b4fb796396a54053ed29c65bd7476..417d1fdcfac30ba7a180e06c3ae0d024a4dc7b93 100644 (file)
@@ -93,15 +93,17 @@ PVE::JSONSchema::register_format('prune-backups', $prune_backups_format, \&valid
 sub validate_prune_backups {
     my ($prune_backups) = @_;
 
-    my $keep_all = delete $prune_backups->{'keep-all'};
+    my $res = { $prune_backups->%* };
 
-    if (!scalar(grep {$_ > 0} values %{$prune_backups})) {
-       $prune_backups = { 'keep-all' => 1 };
+    my $keep_all = delete $res->{'keep-all'};
+
+    if (scalar(grep { $_ > 0 } values %{$res}) == 0) {
+       $res = { 'keep-all' => 1 };
     } elsif ($keep_all) {
        die "keep-all cannot be set together with other options.\n";
     }
 
-    return $prune_backups;
+    return $res;
 }
 register_standard_option('prune-backups', {
     description => "The retention options with shorter intervals are processed first " .