From: Dietmar Maurer Date: Mon, 20 Feb 2017 11:40:33 +0000 (+0100) Subject: SectionConfig: add new parameter $skip_type to createSchema() X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=9c2e403407ebec8e1ad946e190b86b40b8c2ca13 SectionConfig: add new parameter $skip_type to createSchema() This is useful when there is only a single type of entries. --- diff --git a/src/PVE/SectionConfig.pm b/src/PVE/SectionConfig.pm index bfe4f8b..e489b7c 100644 --- a/src/PVE/SectionConfig.pm +++ b/src/PVE/SectionConfig.pm @@ -51,7 +51,7 @@ sub plugindata { } sub createSchema { - my ($class) = @_; + my ($class, $skip_type) = @_; my $pdata = $class->private(); my $propertyList = $pdata->{propertyList}; @@ -71,6 +71,8 @@ sub createSchema { }; foreach my $p (keys %$propertyList) { + next if $skip_type && $p eq 'type'; + if (!$propertyList->{$p}->{optional}) { $props->{$p} = $propertyList->{$p}; next;