]> git.proxmox.com Git - pve-cluster.git/commitdiff
datacenter.cfg: fix fall back for undefined config
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 15 Nov 2021 13:27:12 +0000 (14:27 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 15 Nov 2021 13:27:18 +0000 (14:27 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Reported-by: Oguz Bektas <o.bektas@proxmox.com>
data/PVE/DataCenterConfig.pm

index 2e802d3186d3d76385c643f29d8d298f96f0bf0d..89c7ad45a104a46cf6eb73484fc8a8d5ccfb2883 100644 (file)
@@ -231,6 +231,8 @@ sub get_datacenter_schema { return $datacenter_schema };
 sub parse_datacenter_config {
     my ($filename, $raw) = @_;
 
 sub parse_datacenter_config {
     my ($filename, $raw) = @_;
 
+    $raw = '' if !defined($raw);
+
     # description may be comment or key-value pair (or both)
     my $comment = '';
     my @lines = split(/\n/, $raw);
     # description may be comment or key-value pair (or both)
     my $comment = '';
     my @lines = split(/\n/, $raw);
@@ -241,7 +243,7 @@ sub parse_datacenter_config {
     }
 
     # parse_config ignores lines with # => use $raw
     }
 
     # parse_config ignores lines with # => use $raw
-    my $res = PVE::JSONSchema::parse_config($datacenter_schema, $filename, $raw // '');
+    my $res = PVE::JSONSchema::parse_config($datacenter_schema, $filename, $raw);
 
     $res->{description} = $comment;
 
 
     $res->{description} = $comment;