[pve-devel] [pve-network] only parse version if local sdn file exists
Stoiko Ivanov
s.ivanov at proxmox.com
Tue May 5 17:22:01 CEST 2020
if a file does not exist PVE::Tools::file_read_firstline returns undef.
This happens e.g. if you install the libpve-network-perl package before
creating the local sdn file.
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
caught in my journal after installing updates today:
May 05 17:17:20 rosa pvestatd[21735]: Use of uninitialized value $versionstr in pattern match (m//) at /usr/share/perl5/PVE/Network/SDN/Zones.pm line 141.
PVE/Network/SDN/Zones.pm | 3 +++
1 file changed, 3 insertions(+)
diff --git a/PVE/Network/SDN/Zones.pm b/PVE/Network/SDN/Zones.pm
index dbb1f30..2ca967f 100644
--- a/PVE/Network/SDN/Zones.pm
+++ b/PVE/Network/SDN/Zones.pm
@@ -138,6 +138,9 @@ sub write_etc_network_config {
sub read_etc_network_config_version {
my $versionstr = PVE::Tools::file_read_firstline($local_network_sdn_file);
+
+ return if !defined($versionstr);
+
if ($versionstr =~ m/^\#version:(\d+)$/) {
return $1;
}
--
2.20.1
More information about the pve-devel
mailing list