Skip to content

Commit

Permalink
* Fixed a bug where some Anvil! passwords needed to be altered to wor…
Browse files Browse the repository at this point in the history
…k with IPMI and this adaptation wasn't happening.

* Removed the default '--host-uuid' from striker-installer.example for two reasons;
** 1. If the same kickstart is used, unaltered, on different dashboards they will have matching host_uuid entries in hosts (bug fix).
** 2. On rebuild, the host UUID could differ when using dmidecode's system-uuid would provide consistency over reinstalls (improved handling).

Signed-off-by: Digimer <digimer@alteeve.ca>
  • Loading branch information
Digimer committed Jul 3, 2017
1 parent d604c69 commit 5c3a693
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 41 deletions.
16 changes: 4 additions & 12 deletions AN/Tools/InstallManifest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3309,9 +3309,7 @@ sub configure_ipmi_on_node
if ($line =~ /Success/i)
{
# Woo!
$an->Log->entry({log_level => 2, message_key => "log_0130", message_variables => {
channel => $channel,
}, file => $THIS_FILE, line => __LINE__});
$an->Log->entry({log_level => 2, message_key => "log_0130", message_variables => { target => $channel }, file => $THIS_FILE, line => __LINE__});
}
elsif ($line =~ /wrong password size/i)
{
Expand All @@ -3323,9 +3321,7 @@ sub configure_ipmi_on_node
{
# Password didn't take. :(
$return_code = 1;
$an->Log->entry({log_level => 1, message_key => "log_0132", message_variables => {
channel => $channel,
}, file => $THIS_FILE, line => __LINE__});
$an->Log->entry({log_level => 1, message_key => "log_0132", message_variables => { target => $channel }, file => $THIS_FILE, line => __LINE__});
}
}
if ($try_20)
Expand All @@ -3350,17 +3346,13 @@ sub configure_ipmi_on_node
if ($line =~ /Success/i)
{
# Woo!
$an->Log->entry({log_level => 2, message_key => "log_0133", message_variables => {
channel => $channel,
}, file => $THIS_FILE, line => __LINE__});
$an->Log->entry({log_level => 2, message_key => "log_0133", message_variables => { target => $channel }, file => $THIS_FILE, line => __LINE__});
}
elsif ($line =~ /password incorrect/i)
{
# Password didn't take. :(
$return_code = 1;
$an->Log->entry({log_level => 1, message_key => "log_0132", message_variables => {
channel => $channel,
}, file => $THIS_FILE, line => __LINE__});
$an->Log->entry({log_level => 1, message_key => "log_0132", message_variables => { target => $channel }, file => $THIS_FILE, line => __LINE__});
}
}
}
Expand Down
31 changes: 20 additions & 11 deletions AN/Tools/ScanCore.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5744,15 +5744,7 @@ sub parse_install_manifest
my $pdu3_key = "anvil_node".$i."_pdu3_outlet";
my $pdu4_key = "anvil_node".$i."_pdu4_outlet";

# IPMI is, by default, tempremental about passwords. If the manifest doesn't specify
# the password to use, we'll copy the cluster password but then strip out special
# characters and shorten it to 16 characters or less.
my $default_ipmi_pw = $an->data->{cgi}{anvil_password};
$default_ipmi_pw =~ s/!//g;
if (length($default_ipmi_pw) > 16)
{
$default_ipmi_pw = substr($default_ipmi_pw, 0, 16);
}
my $default_ipmi_pw = $an->data->{cgi}{anvil_password};

# Find the IPMI, PDU and KVM reference names
my $ipmi_reference = "";
Expand Down Expand Up @@ -5861,6 +5853,23 @@ sub parse_install_manifest
name1 => "cgi::$ipmi_password_key", value1 => $an->data->{cgi}{$ipmi_password_key},
}, file => $THIS_FILE, line => __LINE__});

# IPMI is, by default, tempremental about passwords. If the manifest doesn't specify the
# password to use, we'll copy the cluster password but then strip out special characters and
# shorten it to 16 characters or less.
$an->data->{cgi}{$ipmi_password_key} =~ s/ //g;
$an->data->{cgi}{$ipmi_password_key} =~ s/!//g;
if (length($an->data->{cgi}{$ipmi_password_key}) > 16)
{
$an->data->{cgi}{$ipmi_password_key} = substr($an->data->{cgi}{$ipmi_password_key}, 0, 16);
}

# Make sure the password matches later when we generate the cluster.conf file.
$an->data->{install_manifest}{$uuid}{node}{$node}{ipmi}{$ipmi_reference}{password} = $an->data->{cgi}{$ipmi_password_key};
$an->Log->entry({log_level => 4, message_key => "an_variables_0002", message_variables => {
name1 => "cgi::$ipmi_password_key", value1 => $an->data->{cgi}{$ipmi_password_key},
name2 => "install_manifest::${uuid}::node::${node}::ipmi::${ipmi_reference}::password", value2 => $an->data->{install_manifest}{$uuid}{node}{$node}{ipmi}{$ipmi_reference}{password},
}, file => $THIS_FILE, line => __LINE__});

# If the user remapped their network, we don't want to undo the results.
if (not $an->data->{cgi}{perform_install})
{
Expand Down Expand Up @@ -5959,8 +5968,8 @@ sub parse_install_manifest
}
# Build the string
my $string = "<device name=\"$reference\"";
$string .= " ipaddr=\"$name\"" if $name;
$string .= " login=\"$user\"" if $user;
$string .= " ipaddr=\"$name\"" if $name;
$string .= " login=\"$user\"" if $user;
# One or the other, not both.
if ($password)
{
Expand Down
6 changes: 0 additions & 6 deletions tools/anvil-generate-iso
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,6 @@ sub generate_kickstart_body
my $packages = get_packages($conf, $machine);
my $common_post = get_common_post($conf);
my $copy_logs = get_copy_logs($conf);
my $host_uuid = get_uuid($conf);

# (De)branding doesn't apply to the kickstart comment header.
my $ks_body = "### $conf->{sys}{ks}{company_name} - $conf->{sys}{ks}{anvil_name} - $conf->{sys}{ks}{byline}
Expand Down Expand Up @@ -905,10 +904,6 @@ cat > ".$conf->{path}{example_install}." << EOF
# and then call it with 'sh ".$conf->{path}{example_install}."' to save typing
# all this out.
#
# If you are rebuilding or replacing a dashboard and you know what the old host
# UUID was, you can specify it with '--host-uuid <uuid>' to have Scanner link
# this machine to the previous one's data in the ScanCore database.
#
# To understand what all these switches do, and what other switches are
# available, please run './striker-installer --help'.
Expand All @@ -920,7 +915,6 @@ cat > ".$conf->{path}{example_install}." << EOF
-b $my_bcn_ip/$conf->{sys}{ks}{bcn_netmask} \\\\
-p $dhcp_range \\\\
--peer-dashboard hostname=$conf->{sys}{ks}{prefix}-striker0${peer_number}.$conf->{sys}{ks}{domain},bcn_ip=$peer_ip \\\\
--host-uuid $host_uuid \\\\
";
# Use '--rhn' on RHEL only.
if ($conf->{sys}{os_type} eq "rhel")
Expand Down
46 changes: 34 additions & 12 deletions tools/striker-installer
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ my $conf = {
'chmod' => "/bin/chmod",
'chown' => "/bin/chown",
curl => "/usr/bin/curl",
dmidecode => "/usr/sbin/dmidecode",
echo => "/bin/echo",
gcc => "/usr/bin/gcc",
git => "/usr/bin/git",
Expand Down Expand Up @@ -5505,6 +5506,34 @@ sub install_striker_files
exit(43);
}
}
else
{
# Use the system UUID as reported by dmidecode.
my $shell_call = $conf->{executable}{dmidecode}." --string system-uuid";
my $host_uuid = "";
logger($conf, $THIS_FILE, __LINE__, "shell_call: [$shell_call]", 3);
open (my $file_handle, "$shell_call 2>&1 |") or die "$THIS_FILE ".__LINE__."; Failed to call: [$shell_call], error was: $!\n";
while(<$file_handle>)
{
chomp;
my $line = $_;
logger($conf, $THIS_FILE, __LINE__, "- Output: [$line]", 1);
if ($line =~ /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i)
{
$host_uuid = lc($line);
logger($conf, $THIS_FILE, __LINE__, "- host_uuid: [$host_uuid]", 1);
}
}
close $file_handle;

if ($host_uuid)
{
logger($conf, $THIS_FILE, __LINE__, "- The system UUID is being used for the host UUID.", 1);
open (my $file_handle, ">", $conf->{path}{host_uuid}) or die "$THIS_FILE ".__LINE__."; Failed to write: [$conf->{path}{host_uuid}], the error was: $!\n";
print $file_handle $host_uuid."\n";
close $file_handle;
}
}

# Update /etc/striker/striker.conf if a custom config was not used.
if (not $conf->{switches}{'custom-config'})
Expand Down Expand Up @@ -8657,18 +8686,11 @@ SWITCHES
If you want to use a set UUID to identify this machine in ScanCore, you
can do so using this switch. This will only make sense if you are
rebuilding or replacing an old UUID. To record a machine's existing
host UUID, back up:
|;
$help .= " $conf->{path}{host_uuid}\n";
$help .= q|
In it will be the UUID used to identify each Anvil!
machine (Striker dashboards and Anvil! nodes). Note that the Install
Manifest records the UUIDs assigned to nodes as well. So replacing a
node using the previous manifest automatically re-uses the previous
host UUID.
rebuilding or replacing an old dashboard with new hardware and you want
to use the old UUID to link the systems in the ScanCore database.
Normally, the system UUID reported by dmidecode is used.
-i <ip_address/netmask>,dg=<ip_address>[,dns1=<ip_address>,dns2=<ip_address>]
This sets the IP address and subnet to be assigned to the
Expand Down

0 comments on commit 5c3a693

Please sign in to comment.