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.csa...@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


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to