From b5e2b244dd794e982811e37bff05c7559b800087 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 15 Nov 2021 14:27:12 +0100 Subject: [PATCH] datacenter.cfg: fix fall back for undefined config Signed-off-by: Thomas Lamprecht Reported-by: Oguz Bektas --- data/PVE/DataCenterConfig.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- 2.39.2