[pve-devel] [PATCH access-control 1/4] domain sync: make options actually required

Dominik Csapak d.csapak at proxmox.com
Mon Apr 6 13:31:51 CEST 2020


we want the api options to be optional, but only as long as there are
default values set in the realm config

since they are all marked as optional (else they would be required in
the api) this check did not work as intended

instead, check if there exists a 'default' instead (which we then use)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Domains.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/API2/Domains.pm b/PVE/API2/Domains.pm
index 8ae1db0..b42d4f6 100644
--- a/PVE/API2/Domains.pm
+++ b/PVE/API2/Domains.pm
@@ -359,7 +359,7 @@ my $parse_sync_opts = sub {
 	} elsif (!exists $res->{$opt}) {
 	    raise_param_exc({
 		"$opt" => 'Not passed as parameter and not defined in realm default sync options.'
-	    }) if !$fmt->{optional};
+	    }) if !exists $fmt->{default};
 	    $res->{$opt} = $fmt->{default} if exists $fmt->{default};
 	}
     }
-- 
2.20.1





More information about the pve-devel mailing list