]> git.proxmox.com Git - pve-network.git/commitdiff
network reload: fix UPID parsing
authorAlexandre Derumier <aderumier@odiso.com>
Thu, 20 Apr 2023 21:36:22 +0000 (23:36 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 6 Jun 2023 08:23:57 +0000 (10:23 +0200)
When warning or error from ifreload are logged they are received in
1 line in result of pvesh.

So, the UPID might not always start at the beginning, which was
assumed by the old code, failing parsing it, throwing a warning like:

> Use of uninitialized value $upid in pattern match (m//) at /usr/share/perl5/PVE/Tools.pm line 1106.
> Use of uninitialized value $upid in concatenation (.) or string at /usr/share/perl5/PVE/Tools.pm line 1120.

Drop the start anchor of the regex.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/API2/Network/SDN.pm

index f129d607e70db370adf9c75c02769012125a494e..33ecfb725435b0b7b9f0379045749be3c389694c 100644 (file)
@@ -86,9 +86,10 @@ my $create_reload_network_worker = sub {
 
     # FIXME: how to proxy to final node ?
     my $upid;
+    print "$nodename: reloading network config\n";
     run_command(['pvesh', 'set', "/nodes/$nodename/network"], outfunc => sub {
        my $line = shift;
-       if ($line =~ /^["']?(UPID:[^\s"']+)["']?$/) {
+       if ($line =~ /["']?(UPID:[^\s"']+)["']?$/) {
            $upid = $1;
        }
     });