From 2be72140c9a003abba10b0f2b9be7f495f4f76ef Mon Sep 17 00:00:00 2001 From: Jed Reynolds Date: Mon, 5 Apr 2021 17:02:30 -0700 Subject: [PATCH] adjust_apache.pl: fixes printing more than one copy of the current management hostname This was happening when a unit was getting moved between networks and a totally different IP was found for it Signed-off-by: Jed Reynolds --- adjust_apache.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/adjust_apache.pl b/adjust_apache.pl index 3f233c64..d071b1f4 100755 --- a/adjust_apache.pl +++ b/adjust_apache.pl @@ -340,7 +340,9 @@ if (-f "$fname") { print "old[$ln]\n" if ($debug); # if we are comments or blank lines, preserve them next if ($ln =~ /LF-HOSTNAME-NEXT/); - next if ($ln =~ /^$host_map{$MgrHostname}\s+/); + next if ($ln =~ /\b$MgrHostname\b/); # skip our mgt hostname + next if ($ln =~ /^$host_map{$MgrHostname}\s+/); # line starts with present IP addr + if (($ln =~ /^\s*$/) || ($ln =~ /^\s*#/)) { push(@newlines, $ln); next;