all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH cluster] parse_datacenter_config: return early if no raw data for parsing
@ 2021-11-15 12:58 Oguz Bektas
  2021-11-15 14:00 ` Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Oguz Bektas @ 2021-11-15 12:58 UTC (permalink / raw)
  To: pve-devel

in case datacenter.cfg file is missing (e.g. because node is
standalone), it causes a warning message on 'split'.

avoid the warnings by doing an early return to stop processing in case
we got an empty config.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
---
 data/PVE/DataCenterConfig.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/data/PVE/DataCenterConfig.pm b/data/PVE/DataCenterConfig.pm
index 2e802d3..8a5892d 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) = @_;
 
+    return {} if !defined($raw);
+
     # description may be comment or key-value pair (or both)
     my $comment = '';
     my @lines = split(/\n/, $raw);
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-15 14:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 12:58 [pve-devel] [PATCH cluster] parse_datacenter_config: return early if no raw data for parsing Oguz Bektas
2021-11-15 14:00 ` Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal