]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/RESTHandler.pm
show warning when using VLAN 1 on a VLAN aware bridge
[pve-common.git] / src / PVE / RESTHandler.pm
index 1823b012cf6b4553c1fd71abdc7fa7603727b09c..3b9511419ceccc3dbb81d15812b4fb2798ec73b4 100644 (file)
@@ -6,7 +6,6 @@ use warnings;
 use PVE::SafeSyslog;
 use PVE::Exception qw(raise raise_param_exc);
 use PVE::JSONSchema;
-use PVE::PodParser;
 use HTTP::Status qw(:constants :is status_message);
 use Text::Wrap;
 use Clone qw(clone);
@@ -34,9 +33,10 @@ sub api_clone_schema {
        foreach my $p (keys %$d) {
            my $pd = $d->{$p};
            if ($p =~ m/^([a-z]+)(\d+)$/) {
-               if ($2 == 0) {
-                   $p = "$1\[n\]";
-               } elsif (defined($d->{$1.'0'})) {
+               my ($name, $idx) = ($1, $2);
+               if ($idx == 0) {
+                   $p = "${name}[n]";
+               } elsif (defined($d->{"${name}0"})) {
                    next; # only handle once for -xx0, but only if -xx0 exists
                }
            }
@@ -420,7 +420,7 @@ my $get_property_description = sub {
 
     chomp $descr;
 
-    my $type = PVE::PodParser::schema_get_type_text($phash);
+    my $type = PVE::JSONSchema::schema_get_type_text($phash);
 
     if ($hidepw && $name eq 'password') {
        $type = '';
@@ -568,9 +568,9 @@ sub usage_str {
 
        my $base = $k;
        if ($k =~ m/^([a-z]+)(\d+)$/) {
-           my $name = $1;
+           my ($name, $idx) = ($1, $2);
            next if $idx_param->{$name};
-           if ($2 == 0) {
+           if ($idx == 0) {
                $idx_param->{$name} = 1;
                $base = "${name}[n]";
            }
@@ -634,9 +634,9 @@ sub dump_properties {
 
        my $base = $k;
        if ($k =~ m/^([a-z]+)(\d+)$/) {
-           my $name = $1;
+           my ($name, $idx) = ($1, $2);
            next if $idx_param->{$name};
-           if ($2 == 0) {
+           if ($idx == 0) {
                $idx_param->{$name} = 1;
                $base = "${name}[n]";
            }