]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/JSONSchema.pm
print_property_string: skip undefined values
[pve-common.git] / src / PVE / JSONSchema.pm
index 817ff4cce51e210af3f92207fc91497ee18324b5..e83d8dea42a3797bc610530bea86f3aca6a6f5ea 100644 (file)
@@ -248,7 +248,7 @@ register_format('CIDRv4', \&pve_verify_cidrv4);
 sub pve_verify_cidrv4 {
     my ($cidr, $noerr) = @_;
 
-    if ($cidr =~ m!^(?:$IPV4RE)(?:/(\d+))$! && ($1 > 7) &&  ($1 < 32)) {
+    if ($cidr =~ m!^(?:$IPV4RE)(?:/(\d+))$! && ($1 > 7) &&  ($1 <= 32)) {
        return $cidr;
     }
 
@@ -588,6 +588,7 @@ sub print_property_string {
 
        my $typeformat = $format->{$key}->{format};
        my $value = $data->{$key};
+       next if !defined($value);
        $text .= $comma;
        $comma = ',';
        if ($typeformat && $typeformat eq 'disk-size') {