* 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. 40
      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. 4
      tools/test.pl

@ -10051,7 +10051,7 @@ sub manage_anvil_conf
$host_seen = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"s1:value" => $value,
"s2:port" => $port,
"s2:port" => $db_port,
"s3:host_seen" => $host_seen,
}});
if ($remove)
@ -10067,7 +10067,7 @@ sub manage_anvil_conf
}});
next;
}
elsif ($value eq $port)
elsif ($value eq $db_port)
{
# No change.
$port_different = 0;
@ -10077,7 +10077,7 @@ sub manage_anvil_conf
{
# Needs to be updated.
$update_reported = 1;
$line = $variable.$left_space."=".$right_space.$port;
$line = $variable.$left_space."=".$right_space.$db_port;
$rewrite = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
update_reported => $update_reported,
@ -10092,7 +10092,7 @@ sub manage_anvil_conf
$host_seen = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => {
"s1:value" => $value,
"s2:password" => $anvil->Log->is_secure($password),
"s2:password" => $anvil->Log->is_secure($db_password),
"s3:host_seen" => $host_seen,
}});
if ($remove)
@ -10108,7 +10108,7 @@ sub manage_anvil_conf
}});
next;
}
elsif ($value eq $password)
elsif ($value eq $db_password)
{
# No change.
$password_different = 0;
@ -10118,7 +10118,7 @@ sub manage_anvil_conf
{
# Changed, update it
$update_reported = 1;
$line = $variable.$left_space."=".$right_space.$password;
$line = $variable.$left_space."=".$right_space.$db_password;
$rewrite = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
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,
# we'll touch 'type.X' file
my $check_types = {
'striker' => 1,
'node' => 1,
'dr' => 1,
};
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 }});
if ($return_code eq "0")
{
# 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 }});
$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;
@ -778,14 +789,33 @@ sub host_type
file => $file,
}});
# If we have a file and we're root, touch to the file.
if (($file) && (($< == 0) or ($> == 0)))
if (($< == 0) or ($> == 0))
{
foreach my $test_type (sort {$a cmp $b} keys %{$check_types})
{
my $test_key = "type.".$test_type;
my $test_file = $anvil->data->{path}{configs}{$test_key};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"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, secure => 0, list => { error => $error }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { error => $error }});
}
}
last;
}

@ -443,7 +443,7 @@ sub host_name
# Underscores are allowd in domain names, but not host names.
my %options = (domain_allow_underscore => 1);
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 }});
if (not $test)
{

@ -3,7 +3,7 @@
%define anvilgroup admin
Name: anvil
Version: 3.0
Release: 33%{?dist}
Release: 34%{?dist}
Summary: Alteeve Anvil! complete package.
License: GPLv2+
@ -72,6 +72,7 @@ Requires: postgresql-plperl
Requires: rsync
Requires: syslinux
Requires: tmux
Requires: usbutils
Requires: vim
Requires: wget
# iptables-services conflicts with firewalld
@ -364,6 +365,9 @@ fi
%changelog
* tbd Madison Kelly <mkelly@alteeve.ca> 3.0-34
- Updated source.
* Thu Jul 16 2020 Madison Kelly <mkelly@alteeve.ca> 3.0-33
- 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_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_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. -->
<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_port = $anvil->data->{database}{$host_uuid}{port};
$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_port => $db_port,
db_password => $anvil->Log->is_secure($db_password),
@ -181,7 +181,7 @@ sub add_databases
if ($db_host)
{
my $failed = $anvil->Database->manage_anvil_conf({
debug => 2,
debug => 3,
target => $target,
remote_user => "root",
password => $anvil->data->{data}{password},
@ -208,7 +208,6 @@ sub add_databases
}
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"});
update_progress($anvil, 100, "error_0084");
$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."!!");
# 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}::port" => $anvil->data->{database}{$uuid}{port},
"database::${uuid}::password" => $anvil->Log->is_secure($anvil->data->{database}{$uuid}{password}),
@ -276,7 +275,7 @@ sub add_databases
if ($peer_host)
{
my $failed = $anvil->Database->manage_anvil_conf({
debug => 2,
debug => 3,
target => $target,
remote_user => "root",
password => $anvil->data->{data}{password},

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

Loading…
Cancel
Save