use base 'Exporter';
our @EXPORT_OK = qw(
-register_standard_option
get_standard_option
+parse_property_string
+register_standard_option
);
# Note: This class implements something similar to JSON schema, but it is not 100% complete.
sub pve_verify_configid {
my ($id, $noerr) = @_;
- if ($id !~ m/^[a-z][a-z0-9_]+$/i) {
+ if ($id !~ m/^[a-z][a-z0-9_-]+$/i) {
return undef if $noerr;
die "invalid configuration ID '$id'\n";
}
} elsif ($entry =~ m/^([^:]+):([^:]+)$/) {
my ($source, $target) = ($1, $2);
eval {
- PVE::JSONSchema::check_format($idformat, $source, '');
- PVE::JSONSchema::check_format($idformat, $target, '');
+ check_format($idformat, $source, '');
+ check_format($idformat, $target, '');
};
- die "entry '$entry' contains invalid ID - $@\n"
- if $@;
+ die "entry '$entry' contains invalid ID - $@\n" if $@;
die "duplicate mapping for source '$source'\n"
- if $map->{entries}->{$source};
+ if exists $map->{entries}->{$source};
$map->{entries}->{$source} = $target;
} else {
eval {
- PVE::JSONSchema::check_format($idformat, $entry);
+ check_format($idformat, $entry);
};
-
- die "entry '$entry' contains invalid ID - $@\n"
- if $@;
+ die "entry '$entry' contains invalid ID - $@\n" if $@;
die "default target ID can only be provided once\n"
- if $map->{default};
+ if exists $map->{default};
$map->{default} = $entry;
}
}
die "identity mapping cannot be combined with other mappings\n"
- if $map->{identity} && ($map->{default} || $map->{entries});
+ if $map->{identity} && ($map->{default} || exists $map->{entries});
return $map;
}