From: Oguz Bektas <o.bektas@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH cluster] parse_datacenter_config: return early if no raw data for parsing
Date: Mon, 15 Nov 2021 13:58:46 +0100 [thread overview]
Message-ID: <20211115125846.1891390-1-o.bektas@proxmox.com> (raw)
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
next reply other threads:[~2021-11-15 12:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-15 12:58 Oguz Bektas [this message]
2021-11-15 14:00 ` Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211115125846.1891390-1-o.bektas@proxmox.com \
--to=o.bektas@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox