X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=src%2FPVE%2FSectionConfig.pm;h=3030f6018e024d804de705f3c29c204e6613f160;hb=825247bdb222c63f10f6c5d99ea2038bea456256;hp=71d296e6574f7a11d47a67083a45c5188c1b4887;hpb=771d18f5c7be2055f0c9012f7f921f6d5f6337db;p=pve-common.git diff --git a/src/PVE/SectionConfig.pm b/src/PVE/SectionConfig.pm index 71d296e..3030f60 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; @@ -181,7 +184,7 @@ sub init { } $propertyList->{type}->{type} = 'string'; - $propertyList->{type}->{enum} = [keys %$plugins]; + $propertyList->{type}->{enum} = [sort keys %$plugins]; } sub lookup { @@ -200,7 +203,7 @@ sub lookup_types { my $pdata = $class->private(); - return [ keys %{$pdata->{plugins}} ]; + return [ sort keys %{$pdata->{plugins}} ]; } sub decode_value { @@ -393,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 {