From d155c2eb66fbac7a10855bfb1a487beea39c2be9 Mon Sep 17 00:00:00 2001 From: Digimer Date: Mon, 24 May 2021 20:03:17 -0400 Subject: [PATCH] * Fixed a bug where 'timeout' would repeatedly get added to drbd's global-common.conf file. Signed-off-by: Digimer --- Anvil/Tools/DRBD.pm | 54 ++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/Anvil/Tools/DRBD.pm b/Anvil/Tools/DRBD.pm index 574fe1c1..268f737b 100644 --- a/Anvil/Tools/DRBD.pm +++ b/Anvil/Tools/DRBD.pm @@ -2769,25 +2769,25 @@ sub update_global_common } } - if ($line =~ /(\s*)timeout(\s+)(.*?)(;.*)$/) + if ($line =~ /(\s*)ping-timeout(\s+)(.*?)(;.*)$/) { - my $left_space = $1; - my $middle_space = $2; - my $value = $3; - my $right_side = $4; - $timeout_seen = 1; + my $left_space = $1; + my $middle_space = $2; + my $value = $3; + my $right_side = $4; + $ping_timeout_seen = 1; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { - 's1:left_space' => $left_space, - 's2:middle_space' => $middle_space, - 's3:value' => $value, - 's4:right_side' => $right_side, - 's5:timeout_seen' => $timeout_seen, + 's1:left_space' => $left_space, + 's2:middle_space' => $middle_space, + 's3:value' => $value, + 's4:right_side' => $right_side, + 's5:ping_timeout_seen' => $ping_timeout_seen, }}); - if ($value ne $say_timeout) + if ($value ne $say_ping_timeout) { $update = 1; - my $new_line = $left_space."timeout".$middle_space.$say_timeout.$right_side; + my $new_line = $left_space."ping-timeout".$middle_space.$say_ping_timeout.$right_side; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { 's1:update' => $update, 's2:new_line' => $new_line, @@ -2798,26 +2798,26 @@ sub update_global_common next; } } - - if ($line =~ /(\s*)ping-timeout(\s+)(.*?)(;.*)$/) + # For some reason, this matches 'ping-timeout' hence the 'else'. + elsif ($line =~ /(\s*)timeout(\s+)(.*?)(;.*)$/) { - my $left_space = $1; - my $middle_space = $2; - my $value = $3; - my $right_side = $4; - $ping_timeout_seen = 1; + my $left_space = $1; + my $middle_space = $2; + my $value = $3; + my $right_side = $4; + $timeout_seen = 1; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { - 's1:left_space' => $left_space, - 's2:middle_space' => $middle_space, - 's3:value' => $value, - 's4:right_side' => $right_side, - 's5:ping_timeout_seen' => $ping_timeout_seen, + 's1:left_space' => $left_space, + 's2:middle_space' => $middle_space, + 's3:value' => $value, + 's4:right_side' => $right_side, + 's5:timeout_seen' => $timeout_seen, }}); - if ($value ne $say_ping_timeout) + if ($value ne $say_timeout) { $update = 1; - my $new_line = $left_space."ping-timeout".$middle_space.$say_ping_timeout.$right_side; + my $new_line = $left_space."timeout".$middle_space.$say_timeout.$right_side; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { 's1:update' => $update, 's2:new_line' => $new_line,