* Fixed a bug in Database->manage_anvil_conf() where initializing a host set the DB information with the wrong DB port and password.

* Fixed a bug in Get->host_type() the type wasn't being set for nodes and dr hosts.
* Fixed a bug in Validate->host_name() where the wrong method was being called.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent e65a9fbbec
commit 99afd2e936
  1. 12
      Anvil/Tools/Database.pm
  2. 50
      Anvil/Tools/Get.pm
  3. 2
      Anvil/Tools/Validate.pm
  4. 6
      rpm/SPECS/anvil.spec
  5. 1
      share/words.xml
  6. 9
      tools/striker-initialize-host
  7. 6
      tools/test.pl

@ -10051,7 +10051,7 @@ sub manage_anvil_conf
$host_seen = 1; $host_seen = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"s1:value" => $value, "s1:value" => $value,
"s2:port" => $port, "s2:port" => $db_port,
"s3:host_seen" => $host_seen, "s3:host_seen" => $host_seen,
}}); }});
if ($remove) if ($remove)
@ -10067,7 +10067,7 @@ sub manage_anvil_conf
}}); }});
next; next;
} }
elsif ($value eq $port) elsif ($value eq $db_port)
{ {
# No change. # No change.
$port_different = 0; $port_different = 0;
@ -10077,7 +10077,7 @@ sub manage_anvil_conf
{ {
# Needs to be updated. # Needs to be updated.
$update_reported = 1; $update_reported = 1;
$line = $variable.$left_space."=".$right_space.$port; $line = $variable.$left_space."=".$right_space.$db_port;
$rewrite = 1; $rewrite = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
update_reported => $update_reported, update_reported => $update_reported,
@ -10092,7 +10092,7 @@ sub manage_anvil_conf
$host_seen = 1; $host_seen = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => {
"s1:value" => $value, "s1:value" => $value,
"s2:password" => $anvil->Log->is_secure($password), "s2:password" => $anvil->Log->is_secure($db_password),
"s3:host_seen" => $host_seen, "s3:host_seen" => $host_seen,
}}); }});
if ($remove) if ($remove)
@ -10108,7 +10108,7 @@ sub manage_anvil_conf
}}); }});
next; next;
} }
elsif ($value eq $password) elsif ($value eq $db_password)
{ {
# No change. # No change.
$password_different = 0; $password_different = 0;
@ -10118,7 +10118,7 @@ sub manage_anvil_conf
{ {
# Changed, update it # Changed, update it
$update_reported = 1; $update_reported = 1;
$line = $variable.$left_space."=".$right_space.$password; $line = $variable.$left_space."=".$right_space.$db_password;
$rewrite = 1; $rewrite = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
update_reported => $update_reported, update_reported => $update_reported,

@ -758,17 +758,28 @@ sub host_type
{ {
# Last gasp here is to use 'rpm' to see which RPMs are installed. If we find one, # Last gasp here is to use 'rpm' to see which RPMs are installed. If we find one,
# we'll touch 'type.X' file # we'll touch 'type.X' file
my $check_types = {
'striker' => 1,
'node' => 1,
'dr' => 1,
};
foreach my $rpm ("anvil-striker", "anvil-node", "anvil-dr") foreach my $rpm ("anvil-striker", "anvil-node", "anvil-dr")
{ {
my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{rpm}." -q ".$rpm}); my ($output, $return_code) = $anvil->System->call({
debug => $debug,
shell_call => $anvil->data->{path}{exe}{rpm}." -q ".$rpm,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { output => $output, return_code => $return_code }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { output => $output, return_code => $return_code }});
if ($return_code eq "0") if ($return_code eq "0")
{ {
# Found out what we are. # Found out what we are.
if ($rpm eq "anvil-striker") if ($output =~ /anvil-(.*?)-/)
{ {
$host_type = "striker"; $host_type = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { host_type => $host_type }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { host_type => $host_type }});
$check_types->{$host_type} = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { "check_types->{$host_type}" => $check_types->{$host_type} }});
} }
my $key = "type.".$host_type; my $key = "type.".$host_type;
@ -778,14 +789,33 @@ sub host_type
file => $file, file => $file,
}}); }});
# If we have a file and we're root, touch to the file. # If we have a file and we're root, touch to the file.
if (($file) && (($< == 0) or ($> == 0))) if (($< == 0) or ($> == 0))
{ {
my $error = $anvil->Storage->write_file({ foreach my $test_type (sort {$a cmp $b} keys %{$check_types})
debug => $debug, {
body => "", my $test_key = "type.".$test_type;
file => $file, my $test_file = $anvil->data->{path}{configs}{$test_key};
}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => { error => $error }}); "check_types->{$test_type}" => $check_types->{$test_type},
test_file => $test_file,
}});
if (($check_types->{$test_type}) && (-e $test_file))
{
# Remove the old type.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0497", variables => { file => $test_file }});
unlink $test_file;
}
}
if ($file)
{
my $error = $anvil->Storage->write_file({
debug => $debug,
body => "",
file => $file,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { error => $error }});
}
} }
last; last;
} }

@ -443,7 +443,7 @@ sub host_name
# Underscores are allowd in domain names, but not host names. # Underscores are allowd in domain names, but not host names.
my %options = (domain_allow_underscore => 1); my %options = (domain_allow_underscore => 1);
my $dvd = Data::Validate::Domain->new(%options); my $dvd = Data::Validate::Domain->new(%options);
my $test = $dvd->hostname($name); my $test = $dvd->is_hostname($name);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { test => $test }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { test => $test }});
if (not $test) if (not $test)
{ {

@ -3,7 +3,7 @@
%define anvilgroup admin %define anvilgroup admin
Name: anvil Name: anvil
Version: 3.0 Version: 3.0
Release: 33%{?dist} Release: 34%{?dist}
Summary: Alteeve Anvil! complete package. Summary: Alteeve Anvil! complete package.
License: GPLv2+ License: GPLv2+
@ -72,6 +72,7 @@ Requires: postgresql-plperl
Requires: rsync Requires: rsync
Requires: syslinux Requires: syslinux
Requires: tmux Requires: tmux
Requires: usbutils
Requires: vim Requires: vim
Requires: wget Requires: wget
# iptables-services conflicts with firewalld # iptables-services conflicts with firewalld
@ -364,6 +365,9 @@ fi
%changelog %changelog
* tbd Madison Kelly <mkelly@alteeve.ca> 3.0-34
- Updated source.
* Thu Jul 16 2020 Madison Kelly <mkelly@alteeve.ca> 3.0-33 * Thu Jul 16 2020 Madison Kelly <mkelly@alteeve.ca> 3.0-33
- Updated source. - Updated source.

@ -929,6 +929,7 @@ If the targets are unique, did you copy the full database directory? A unique id
<key name="log_0494">The daemon: [#!variable!daemon!#] is already stopped on: [#!variable!host!#], nothing to do.</key> <key name="log_0494">The daemon: [#!variable!daemon!#] is already stopped on: [#!variable!host!#], nothing to do.</key>
<key name="log_0495">Stopping the daemon: [#!variable!daemon!#] on: [#!variable!host!#].</key> <key name="log_0495">Stopping the daemon: [#!variable!daemon!#] on: [#!variable!host!#].</key>
<key name="log_0496">One or more servers are still running on the Anvil!, not stopping daemons.</key> <key name="log_0496">One or more servers are still running on the Anvil!, not stopping daemons.</key>
<key name="log_0497">About to remove the old host type file: [#!variable!file!#].</key>
<!-- Messages for users (less technical than log entries), though sometimes used for logs, too. --> <!-- Messages for users (less technical than log entries), though sometimes used for logs, too. -->
<key name="message_0001">The host name: [#!variable!target!#] does not resolve to an IP address.</key> <key name="message_0001">The host name: [#!variable!target!#] does not resolve to an IP address.</key>

@ -168,7 +168,7 @@ sub add_databases
$db_host = $local_ip; $db_host = $local_ip;
$db_port = $anvil->data->{database}{$host_uuid}{port}; $db_port = $anvil->data->{database}{$host_uuid}{port};
$db_password = $anvil->data->{database}{$host_uuid}{password}; $db_password = $anvil->data->{database}{$host_uuid}{password};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
db_host => $db_host, db_host => $db_host,
db_port => $db_port, db_port => $db_port,
db_password => $anvil->Log->is_secure($db_password), db_password => $anvil->Log->is_secure($db_password),
@ -181,7 +181,7 @@ sub add_databases
if ($db_host) if ($db_host)
{ {
my $failed = $anvil->Database->manage_anvil_conf({ my $failed = $anvil->Database->manage_anvil_conf({
debug => 2, debug => 3,
target => $target, target => $target,
remote_user => "root", remote_user => "root",
password => $anvil->data->{data}{password}, password => $anvil->data->{data}{password},
@ -208,7 +208,6 @@ sub add_databases
} }
else else
{ {
### TODO: Left off here; change the message to a proper one.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, key => "error_0084"}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, key => "error_0084"});
update_progress($anvil, 100, "error_0084"); update_progress($anvil, 100, "error_0084");
$anvil->nice_exit({exit_code => 6}); $anvil->nice_exit({exit_code => 6});
@ -231,7 +230,7 @@ sub add_databases
update_progress($anvil, $anvil->data->{job}{progress}, "job_0068,!!host_name!".$target_host."!!"); update_progress($anvil, $anvil->data->{job}{progress}, "job_0068,!!host_name!".$target_host."!!");
# This is a peer. # This is a peer.
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"database::${uuid}::host" => $anvil->data->{database}{$uuid}{host}, "database::${uuid}::host" => $anvil->data->{database}{$uuid}{host},
"database::${uuid}::port" => $anvil->data->{database}{$uuid}{port}, "database::${uuid}::port" => $anvil->data->{database}{$uuid}{port},
"database::${uuid}::password" => $anvil->Log->is_secure($anvil->data->{database}{$uuid}{password}), "database::${uuid}::password" => $anvil->Log->is_secure($anvil->data->{database}{$uuid}{password}),
@ -276,7 +275,7 @@ sub add_databases
if ($peer_host) if ($peer_host)
{ {
my $failed = $anvil->Database->manage_anvil_conf({ my $failed = $anvil->Database->manage_anvil_conf({
debug => 2, debug => 3,
target => $target, target => $target,
remote_user => "root", remote_user => "root",
password => $anvil->data->{data}{password}, password => $anvil->data->{data}{password},

@ -5,8 +5,7 @@ use strict;
use warnings; use warnings;
use Anvil::Tools; use Anvil::Tools;
use Data::Dumper; use Data::Dumper;
use String::ShellQuote;
my $THIS_FILE = ($0 =~ /^.*\/(.*)$/)[0]; my $THIS_FILE = ($0 =~ /^.*\/(.*)$/)[0];
my $running_directory = ($0 =~ /^(.*?)\/$THIS_FILE$/)[0]; my $running_directory = ($0 =~ /^(.*?)\/$THIS_FILE$/)[0];
if (($running_directory =~ /^\./) && ($ENV{PWD})) if (($running_directory =~ /^\./) && ($ENV{PWD}))
@ -24,6 +23,7 @@ $anvil->Log->secure({set => 1});
print "Connecting to the database(s);\n"; print "Connecting to the database(s);\n";
$anvil->Database->connect(); $anvil->Database->connect();
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, secure => 0, key => "log_0132"}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, secure => 0, key => "log_0132"});
$anvil->Get->switches; $anvil->Get->switches;
$anvil->System->configure_ipmi({debug => 2});

Loading…
Cancel
Save