5
0
mirror of git://git.proxmox.com/git/pve-network.git synced 2025-01-18 10:03:54 +03:00

network reload: fix UPID parsing

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>
This commit is contained in:
Alexandre Derumier 2023-04-20 23:36:22 +02:00 committed by Thomas Lamprecht
parent de4e2b9cf4
commit 0626bbf7b3

View 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;
}
});