X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=src%2FPVE%2FSectionConfig.pm;h=6f85b228b81ec82c77d64fbbbc8f0197e5274e01;hb=166e27c74f883d12e12c60c43c57994bfc2ec5bc;hp=f6646f3398a1ec69e9e6c3ae1a71025641d4fbc4;hpb=a3530f55edbec70e6c428a0924f89a6906a44d41;p=pve-common.git diff --git a/src/PVE/SectionConfig.pm b/src/PVE/SectionConfig.pm index f6646f3..6f85b22 100644 --- a/src/PVE/SectionConfig.pm +++ b/src/PVE/SectionConfig.pm @@ -26,6 +26,9 @@ sub register { my $type = $class->type(); my $pdata = $class->private(); + die "duplicate plugin registration (type = $type)" + if defined($pdata->{plugins}->{$type}); + my $plugindata = $class->plugindata(); $pdata->{plugindata}->{$type} = $plugindata; $pdata->{plugins}->{$type} = $class; @@ -68,7 +71,6 @@ sub createSchema { }; foreach my $p (keys %$propertyList) { - next if $p eq 'type'; if (!$propertyList->{$p}->{optional}) { $props->{$p} = $propertyList->{$p}; next; @@ -119,6 +121,9 @@ sub updateSchema { my $modifyable = 0; + my $copts = $class->options(); + $modifyable = 1 if defined($copts->{$p}) && !$copts->{$p}->{fixed}; + foreach my $t (keys %$plugins) { my $opts = $pdata->{options}->{$t} || {}; next if !defined($opts->{$p}); @@ -391,6 +396,9 @@ my $format_config_line = sub { my $ct = $schema->{type}; + die "property '$key' contains a line feed\n" + if ($key =~ m/[\n\r]/) || ($value =~ m/[\n\r]/); + if ($ct eq 'boolean') { return $value ? "\t$key\n" : ''; } else {