From 2c76103a96b7d195c91909b5ef17535fefaf2ba2 Mon Sep 17 00:00:00 2001 From: Digimer Date: Mon, 17 Jan 2022 17:54:46 -0500 Subject: [PATCH] Fixed a bug where, if the host IPMI BMC wouldn't allow spaces in the password and the user had a space, IPMI would never configure or get used as a fence method. Signed-off-by: Digimer --- Anvil/Tools/System.pm | 17 +++++++++++++++++ scancore-agents/scan-cluster/scan-cluster | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Anvil/Tools/System.pm b/Anvil/Tools/System.pm index e9795d8b..d9258c55 100644 --- a/Anvil/Tools/System.pm +++ b/Anvil/Tools/System.pm @@ -1770,6 +1770,16 @@ LIMIT 1 password_length => $password_length, }}); + # If the password has spaces, some IPMI BMCs won't allow them. If we need to use it, we'll take out + # the spaces and shrink the length. + my $ipmi_no_space_password = ""; + if ($ipmi_password =~ /\s/) + { + $ipmi_no_space_password = $ipmi_password; + $ipmi_no_space_password =~ s/\s//g; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 1, list => { ipmi_no_space_password => $ipmi_no_space_password }}); + } + my $subnet_mask = ""; my $gateway = ""; my $in_network = ""; @@ -2229,6 +2239,13 @@ LIMIT 1 } else { + # If we used the no-space password, set it as the ipmi_password now. + if ($ipmi_no_space_password) + { + $ipmi_password = $ipmi_no_space_password; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 1, list => { ipmi_password => $ipmi_password }}); + } + # Change the password and then try again. my $escaped_ipmi_password = shell_quote($ipmi_password); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 1, list => { escaped_ipmi_password => $escaped_ipmi_password }}); diff --git a/scancore-agents/scan-cluster/scan-cluster b/scancore-agents/scan-cluster/scan-cluster index 6bf45ce9..9e13d4d6 100755 --- a/scancore-agents/scan-cluster/scan-cluster +++ b/scancore-agents/scan-cluster/scan-cluster @@ -214,7 +214,7 @@ sub check_fence_delay }}); if ((not $local_server_count) && (not $peer_server_count)) { - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0636"}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0636"}); return(0); } elsif (($local_server_count) && ($peer_server_count))