From: Thomas Lamprecht Date: Mon, 15 Nov 2021 13:27:12 +0000 (+0100) Subject: datacenter.cfg: fix fall back for undefined config X-Git-Url: https://git.proxmox.com/?p=pve-cluster.git;a=commitdiff_plain;h=b5e2b244dd794e982811e37bff05c7559b800087;ds=sidebyside datacenter.cfg: fix fall back for undefined config Signed-off-by: Thomas Lamprecht Reported-by: Oguz Bektas --- diff --git a/data/PVE/DataCenterConfig.pm b/data/PVE/DataCenterConfig.pm index 2e802d3..89c7ad4 100644 --- a/data/PVE/DataCenterConfig.pm +++ b/data/PVE/DataCenterConfig.pm @@ -231,6 +231,8 @@ sub get_datacenter_schema { return $datacenter_schema }; 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); @@ -241,7 +243,7 @@ sub parse_datacenter_config { } # 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;