minLength => 2, maxLength => 20,
});
-PVE::JSONSchema::register_standard_option('pve-storage-id', {
+register_standard_option('pve-storage-id', {
description => "The storage identifier.",
type => 'string', format => 'pve-storage-id',
});
-PVE::JSONSchema::register_standard_option('pve-config-digest', {
+register_standard_option('pve-config-digest', {
description => 'Prevent changes if current configuration file has different SHA1 digest. This can be used to prevent concurrent modifications.',
type => 'string',
optional => 1,
maxLength => 40, # sha1 hex digest lenght is 40
});
-PVE::JSONSchema::register_standard_option('extra-args', {
+register_standard_option('extra-args', {
description => "Extra arguments as array",
type => 'array',
items => { type => 'string' },
die "duplicate key in comma-separated list property: $default_key\n";
}
}
+ die "value without key, but schema does not define a default key\n" if !$default_key;
} else {
die "missing key in comma-separated list property\n";
}
if (ref($format) ne 'HASH') {
my $schema = $format_list->{$format};
- die "not a valid format: $format" if !$schema;
+ die "not a valid format: $format\n" if !$schema;
$format = $schema;
}
# Skip default keys
if ($format->{$key}->{default_key}) {
if ($default_key) {
- warn "multiple default keys in schema ($default_key, $key)";
+ warn "multiple default keys in schema ($default_key, $key)\n";
} else {
$default_key = $key;
$skipped{$key} = 1;
foreach my $key (sort keys %$data) {
delete $required{$key};
next if $skipped{$key};
- die "invalid key: $key" if !$allowed{$key};
+ die "invalid key: $key\n" if !$allowed{$key};
my $typeformat = $format->{$key}->{format};
my $value = $data->{$key};
if ($typeformat && $typeformat eq 'disk-size') {
$text .= "$key=" . format_size($value);
} else {
+ die "illegal value with commas for $key\n" if $value =~ /,/;
$text .= "$key=$value";
}
}
if (my $missing = join(',', keys %required)) {
- die "missing properties: $missing";
+ die "missing properties: $missing\n";
}
return $text;