]> git.proxmox.com Git - pve-network.git/commitdiff
only parse version if local sdn file exists
authorStoiko Ivanov <s.ivanov@proxmox.com>
Tue, 5 May 2020 15:22:01 +0000 (17:22 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 5 May 2020 16:26:51 +0000 (18:26 +0200)
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@proxmox.com>
PVE/Network/SDN/Zones.pm

index dbb1f3007c843a79ed92db55b14f60990e5d2db8..2ca967fd3386e39cfe029e9e2765758cb2e16ede 100644 (file)
@@ -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;
     }