* Added a new parameter called 'sensitive' to Database->connect() that returns after connections before any ancilliary checks are done, minimizing connect time.

* Fixed a problem with Database->insert_or_update_variables() where variable_source_uuid being set to an empty string wasn't converted to NULL.
* Fixed Database->locking() where the way the lock variable was set was rather broken.
* Created Striker->check_httpd_conf() which configured apache to handle the integration of the new WebUI for Anvil! management with the existing WebUI.
* Updated System->update_hosts() to specifically set the 127.0.0.1 and ::1 lines to handle how cloud-init overrides /etc/hosts and breaks CI/CD tests.
* Removed the old index.html as it's now used for the new WebUI.
* Began work on removing DB connection requirements from ocf:alteeve:server.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent 73267a8ea9
commit 24ec17f8f7
  1. 2
      Anvil/Tools/Account.pm
  2. 121
      Anvil/Tools/Database.pm
  3. 91
      Anvil/Tools/Striker.pm
  4. 59
      Anvil/Tools/System.pm
  5. 1
      html/Makefile.am
  6. 8
      html/index.html
  7. 8
      html/skins/alteeve/anvil.html
  8. 339
      ocf/alteeve/server
  9. 7
      share/words.xml
  10. 6
      tools/anvil-configure-host
  11. 11
      tools/anvil-daemon

@ -355,7 +355,7 @@ AND
} }
else else
{ {
# User DID NOT passed a valid username/password. # User DID NOT pass a valid username/password.
$anvil->data->{form}{error_massage} = $anvil->Template->get({file => "main.html", name => "error_message", variables => { error_message => $anvil->Words->string({key => "error_0027"}) }}); $anvil->data->{form}{error_massage} = $anvil->Template->get({file => "main.html", name => "error_message", variables => { error_message => $anvil->Words->string({key => "error_0027"}) }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0184", variables => { $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0184", variables => {
user_agent => $ENV{HTTP_USER_AGENT} ? $ENV{HTTP_USER_AGENT} : "#!string!log_0185!#", user_agent => $ENV{HTTP_USER_AGENT} ? $ENV{HTTP_USER_AGENT} : "#!string!log_0185!#",

@ -1104,6 +1104,10 @@ If set, the connection will be made only to the database server matching the UUI
If set to C<< 1 >>, no attempt to ping a target before connection will happen, even if C<< database::<uuid>::ping = 1 >> is set. If set to C<< 1 >>, no attempt to ping a target before connection will happen, even if C<< database::<uuid>::ping = 1 >> is set.
=head3 sensitive (optional, default '0')
If set to C<< 1 >>, the caller is considered time sensitive and most checks are skipped. This is used when a call must respond as quickly as possible.
=head3 source (optional) =head3 source (optional)
The C<< source >> parameter is used to check the special C<< updated >> table on all connected databases to see when that source (program name, usually) last updated a given database. If the date stamp is the same on all connected databases, nothing further happens. If one of the databases differ, however, a resync will be requested. The C<< source >> parameter is used to check the special C<< updated >> table on all connected databases to see when that source (program name, usually) last updated a given database. If the date stamp is the same on all connected databases, nothing further happens. If one of the databases differ, however, a resync will be requested.
@ -1162,6 +1166,7 @@ sub connect
my $db_uuid = defined $parameter->{db_uuid} ? $parameter->{db_uuid} : ""; my $db_uuid = defined $parameter->{db_uuid} ? $parameter->{db_uuid} : "";
my $no_ping = defined $parameter->{no_ping} ? $parameter->{no_ping} : 0; my $no_ping = defined $parameter->{no_ping} ? $parameter->{no_ping} : 0;
my $check_for_resync = defined $parameter->{check_for_resync} ? $parameter->{check_for_resync} : 0; my $check_for_resync = defined $parameter->{check_for_resync} ? $parameter->{check_for_resync} : 0;
my $sensitive = defined $parameter->{sensitive} ? $parameter->{sensitive} : 0;
my $source = defined $parameter->{source} ? $parameter->{source} : "core"; my $source = defined $parameter->{source} ? $parameter->{source} : "core";
my $sql_file = defined $parameter->{sql_file} ? $parameter->{sql_file} : $anvil->data->{path}{sql}{'anvil.sql'}; my $sql_file = defined $parameter->{sql_file} ? $parameter->{sql_file} : $anvil->data->{path}{sql}{'anvil.sql'};
my $tables = defined $parameter->{tables} ? $parameter->{tables} : ""; my $tables = defined $parameter->{tables} ? $parameter->{tables} : "";
@ -1171,6 +1176,7 @@ sub connect
db_uuid => $db_uuid, db_uuid => $db_uuid,
no_ping => $no_ping, no_ping => $no_ping,
check_for_resync => $check_for_resync, check_for_resync => $check_for_resync,
sensitive => $sensitive,
source => $source, source => $source,
sql_file => $sql_file, sql_file => $sql_file,
tables => $tables, tables => $tables,
@ -1216,6 +1222,12 @@ sub connect
delete $anvil->data->{sys}{database}{identifier}; delete $anvil->data->{sys}{database}{identifier};
} }
if ($sensitive)
{
$check_for_resync = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { check_for_resync => $check_for_resync }});
}
# Now setup or however-many connections # Now setup or however-many connections
my $seen_connections = []; my $seen_connections = [];
my $failed_connections = []; my $failed_connections = [];
@ -1720,7 +1732,16 @@ sub connect
# } # }
} }
# Make sure my host UUID is valud if ($sensitive)
{
# Return here.
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"sys::database::connections" => $anvil->data->{sys}{database}{connections},
}});
return($anvil->data->{sys}{database}{connections});
}
# Make sure my host UUID is valod
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { "sys::host_uuid" => $anvil->data->{sys}{host_uuid} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { "sys::host_uuid" => $anvil->data->{sys}{host_uuid} }});
if ($anvil->data->{sys}{host_uuid} !~ /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/) if ($anvil->data->{sys}{host_uuid} !~ /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/)
{ {
@ -13174,6 +13195,12 @@ sub insert_or_update_variables
return("!!error!!"); return("!!error!!");
} }
if ($variable_source_uuid eq "")
{
$variable_source_uuid = "NULL";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { variable_source_uuid => $variable_source_uuid }});
}
# If we have a variable UUID but not a name, read the variable name. If we don't have a UUID, see if # If we have a variable UUID but not a name, read the variable name. If we don't have a UUID, see if
# we can find one for the given variable name. # we can find one for the given variable name.
if (($anvil->Validate->uuid({uuid => $variable_uuid})) && (not $variable_name)) if (($anvil->Validate->uuid({uuid => $variable_uuid})) && (not $variable_name))
@ -13599,9 +13626,13 @@ sub locking
if ($lock_value) if ($lock_value)
{ {
my $variable_uuid = $anvil->Database->insert_or_update_variables({ my $variable_uuid = $anvil->Database->insert_or_update_variables({
variable_name => $variable_name, variable_name => $variable_name,
variable_value => "", variable_value => "",
update_value_only => 1, variable_default => "",
variable_description => "striker_0289",
variable_section => "database",
variable_source_uuid => "NULL",
variable_source_table => "",
}); });
$anvil->data->{sys}{database}{local_lock_active} = 0; $anvil->data->{sys}{database}{local_lock_active} = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
@ -13622,9 +13653,13 @@ sub locking
{ {
# Yup, do it. # Yup, do it.
my $variable_uuid = $anvil->Database->insert_or_update_variables({ my $variable_uuid = $anvil->Database->insert_or_update_variables({
variable_name => $variable_name, variable_name => $variable_name,
variable_value => $variable_value, variable_value => $variable_value,
update_value_only => 1, variable_default => "",
variable_description => "striker_0289",
variable_section => "database",
variable_source_uuid => "NULL",
variable_source_table => "",
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { variable_uuid => $variable_uuid }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { variable_uuid => $variable_uuid }});
@ -13684,9 +13719,13 @@ sub locking
{ {
# The lock is stale. # The lock is stale.
my $variable_uuid = $anvil->Database->insert_or_update_variables({ my $variable_uuid = $anvil->Database->insert_or_update_variables({
variable_name => $variable_name, variable_name => $variable_name,
variable_value => "", variable_value => "",
update_value_only => 1, variable_default => "",
variable_description => "striker_0289",
variable_section => "database",
variable_source_uuid => "",
variable_source_table => "",
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { variable_uuid => $variable_uuid }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { variable_uuid => $variable_uuid }});
} }
@ -13712,9 +13751,13 @@ sub locking
{ {
# Yup, do it. # Yup, do it.
my $variable_uuid = $anvil->Database->insert_or_update_variables({ my $variable_uuid = $anvil->Database->insert_or_update_variables({
variable_name => $variable_name, variable_name => $variable_name,
variable_value => $variable_value, variable_value => $variable_value,
update_value_only => 1, variable_default => "",
variable_description => "striker_0289",
variable_section => "database",
variable_source_uuid => "NULL",
variable_source_table => "",
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { variable_uuid => $variable_uuid }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { variable_uuid => $variable_uuid }});
@ -14655,7 +14698,12 @@ sub read_variable
variable_source_table => $variable_source_table, variable_source_table => $variable_source_table,
}}); }});
# Do we have either the if (not $variable_source_uuid)
{
$variable_source_uuid = "NULL";
}
# Do we have either the variable name or UUID?
if ((not $variable_name) && (not $variable_uuid)) if ((not $variable_name) && (not $variable_uuid))
{ {
# Throw an error and exit. # Throw an error and exit.
@ -14693,6 +14741,7 @@ AND
} }
} }
$query .= ";"; $query .= ";";
$query =~ s/'NULL'/NULL/g;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0124", variables => { query => $query }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0124", variables => { query => $query }});
my $variable_value = ""; my $variable_value = "";
@ -16466,28 +16515,28 @@ ORDER BY
"sys::database::table::${table}::uuid::${uuid}::last_updated" => $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{last_updated}, "sys::database::table::${table}::uuid::${uuid}::last_updated" => $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{last_updated},
"sys::database::table::${table}::uuid::${uuid}::row_count" => $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{row_count}, "sys::database::table::${table}::uuid::${uuid}::row_count" => $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{row_count},
}}); }});
if ($anvil->data->{sys}{database}{table}{$table}{last_updated} > $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{last_updated}) # if ($anvil->data->{sys}{database}{table}{$table}{last_updated} > $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{last_updated})
{ # {
# Resync needed. # # Resync needed.
my $difference = $anvil->data->{sys}{database}{table}{$table}{last_updated} - $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{last_updated}; # my $difference = $anvil->data->{sys}{database}{table}{$table}{last_updated} - $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{last_updated};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { # $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"s1:difference" => $anvil->Convert->add_commas({number => $difference }), # "s1:difference" => $anvil->Convert->add_commas({number => $difference }),
"s2:sys::database::table::${table}::last_updated" => $anvil->data->{sys}{database}{table}{$table}{last_updated}, # "s2:sys::database::table::${table}::last_updated" => $anvil->data->{sys}{database}{table}{$table}{last_updated},
"s3:sys::database::table::${table}::uuid::${uuid}::last_updated" => $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{last_updated}, # "s3:sys::database::table::${table}::uuid::${uuid}::last_updated" => $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{last_updated},
}}); # }});
#
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "log_0106", variables => { # $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "log_0106", variables => {
seconds => $difference, # seconds => $difference,
table => $table, # table => $table,
uuid => $uuid, # uuid => $uuid,
host => $anvil->Get->host_name_from_uuid({host_uuid => $uuid}), # host => $anvil->Get->host_name_from_uuid({host_uuid => $uuid}),
}}); # }});
#
# Mark it as behind. # # Mark it as behind.
$anvil->Database->_mark_database_as_behind({debug => $debug, uuid => $uuid}); # $anvil->Database->_mark_database_as_behind({debug => $debug, uuid => $uuid});
last; # last;
} # }
elsif ($anvil->data->{sys}{database}{table}{$table}{row_count} > $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{row_count}) if ($anvil->data->{sys}{database}{table}{$table}{row_count} > $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{row_count})
{ {
# Resync needed. # Resync needed.
my $difference = ($anvil->data->{sys}{database}{table}{$table}{row_count} - $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{row_count}); my $difference = ($anvil->data->{sys}{database}{table}{$table}{row_count} - $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{row_count});

@ -6,13 +6,15 @@ package Anvil::Tools::Striker;
use strict; use strict;
use warnings; use warnings;
use Data::Dumper; use Data::Dumper;
use Scalar::Util qw(weaken isweak);
use JSON; use JSON;
use Scalar::Util qw(weaken isweak);
use Text::Diff;
our $VERSION = "3.0.0"; our $VERSION = "3.0.0";
my $THIS_FILE = "Striker.pm"; my $THIS_FILE = "Striker.pm";
### Methods; ### Methods;
# check_httpd_conf
# generate_manifest # generate_manifest
# get_fence_data # get_fence_data
# get_local_repo # get_local_repo
@ -81,6 +83,93 @@ sub parent
# Public methods # # Public methods #
############################################################################################################# #############################################################################################################
=head2 check_httpd_conf
This checks the apache configuration file to ensure it's setup for the Striker dashboard and RPM repository. This method does nothing if called on non-striker dashboard.
This method takes no parameters.
=cut
sub check_httpd_conf
{
my $self = shift;
my $parameter = shift;
my $anvil = $self->parent;
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Striker->check_httpd_conf()" }});
my $update_file = 0;
my $in_dir_module = 0;
my $old_httpd_conf = $anvil->Storage->read_file({file => $anvil->data->{path}{data}{httpd_conf}});
my $new_httpd_conf = "";
foreach my $line (split/\n/, $old_httpd_conf)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { line => $line }});
if ($line =~ /^<IfModule dir_module>/)
{
$in_dir_module = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { in_dir_module => $in_dir_module }});
}
if ($in_dir_module)
{
if ($line =~ /^<\/IfModule>/)
{
$in_dir_module = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { in_dir_module => $in_dir_module }});
}
elsif ($line =~ /^\s+DirectoryIndex (.*)/)
{
my $directory_index = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { directory_index => $directory_index }});
if ($directory_index ne "cgi-bin/striker")
{
$line =~ s/$directory_index/cgi-bin\/striker/;
$update_file = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
line => $line,
update_file => $update_file,
}});
}
}
}
$new_httpd_conf .= $line."\n";
}
if ($update_file)
{
# Write the new file out.
my $db_difference = diff \$old_httpd_conf, \$new_httpd_conf, { STYLE => 'Unified' };
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0625", variables => {
file => $anvil->data->{path}{data}{httpd_conf},
difference => $db_difference,
}});
my $error = $anvil->Storage->write_file({
debug => $debug,
body => $new_httpd_conf,
file => $anvil->data->{path}{data}{httpd_conf},
group => "root",
user => "root",
mode => "0644",
overwrite => 1,
backup => 1,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => { error => $error }});
if (not $error)
{
# Restart apache.
$anvil->System->restart_daemon({
debug => $debug,
daemon => "httpd.service",
});
}
}
return(0);
}
=head2 generate_manifest =head2 generate_manifest
This reads the CGI data coming from the manifest form to generate the manifest XML. This reads the CGI data coming from the manifest form to generate the manifest XML.

@ -4863,10 +4863,12 @@ sub update_hosts
} }
# Read in the existing hosts file # Read in the existing hosts file
my $add_header = 1; my $add_header = 1;
my $changes = 0; my $changes = 0;
my $new_body = ""; my $added_lo_ipv4 = 0;
my $old_body = $anvil->Storage->read_file({ my $added_lo_ipv6 = 0;
my $new_body = "";
my $old_body = $anvil->Storage->read_file({
debug => $debug, debug => $debug,
file => $anvil->data->{path}{configs}{hosts}, file => $anvil->data->{path}{configs}{hosts},
}); });
@ -4909,6 +4911,53 @@ sub update_hosts
next; next;
} }
# If this line is localhost, set it statically. This is needed because cloud-init sets the
# real host name to point to 127.0.0.1 / ::1. (WHY?!)
if ($line =~ /^127.0.0.1\s/)
{
if ($line ne "127.0.0.1\tlocalhost localhost.localdomain localhost4 localhost4.localdomain4")
{
$changes = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { changes => $changes }});
if (not $added_lo_ipv4)
{
$new_body .= "127.0.0.1\tlocalhost localhost.localdomain localhost4 localhost4.localdomain4\n";
$added_lo_ipv4 = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { added_lo_ipv4 => $added_lo_ipv4 }});
}
}
else
{
# Line is as expected.
$added_lo_ipv4 = 1;
$new_body .= $line."\n";
}
next;
}
if ($line =~ /^::1\s/)
{
if ($line ne "::1\t\tlocalhost localhost.localdomain localhost6 localhost6.localdomain6")
{
$changes = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { changes => $changes }});
if (not $added_lo_ipv6)
{
$new_body .= "::1\t\tlocalhost localhost.localdomain localhost6 localhost6.localdomain6\n";
$added_lo_ipv6 = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { added_lo_ipv6 => $added_lo_ipv6 }});
}
}
else
{
# Line is as expected.
$added_lo_ipv6 = 1;
$new_body .= $line."\n";
}
next;
}
# Now pull apart the line and store the entries. # Now pull apart the line and store the entries.
my ($ip_address, $names) = ($line =~ /^(.*?)\s+(.*)$/); my ($ip_address, $names) = ($line =~ /^(.*?)\s+(.*)$/);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
@ -4954,7 +5003,7 @@ sub update_hosts
# Matches, we don't need to deal with this name. # Matches, we don't need to deal with this name.
delete $anvil->data->{hosts}{needed}{$name}; delete $anvil->data->{hosts}{needed}{$name};
} }
elsif ($ip_address ne "127.0.0.1") else
{ {
# The IP has changed. Skip this name (which removes it from the list). # The IP has changed. Skip this name (which removes it from the list).
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0481", variables => { $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0481", variables => {

@ -7,7 +7,6 @@ jqueryuiver = 1.12.1
dist_html_DATA = \ dist_html_DATA = \
favicon.ico \ favicon.ico \
index.html \
jquery-$(jqueryver).js jquery-$(jqueryver).js
# empty dir for now # empty dir for now

@ -1,8 +0,0 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Striker</title>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=cgi-bin/striker">
</head>
<body>
Hi, I'll be right with you...
</body>

@ -2245,6 +2245,14 @@
&nbsp; &nbsp;
</td> </td>
</tr> </tr>
<tr>
<td class="main_option_icon">
<a href="/index.html"><img src="#!data!skin::url!#/images/anvil_icon_on.png" class="top_icon" ></a>
</td>
<td class="main_option">
<a href="/index.html">#!string!striker_0288!#</a>
</td>
</tr>
<tr> <tr>
<td class="main_option_icon"> <td class="main_option_icon">
<a href="?anvil=true&task=prep-host"><img src="#!data!skin::url!#/images/prep-host_icon.png" class="top_icon" ></a> <a href="?anvil=true&task=prep-host"><img src="#!data!skin::url!#/images/prep-host_icon.png" class="top_icon" ></a>

@ -97,16 +97,6 @@ $| = 1;
# in the loop as well to override defaults in code. # in the loop as well to override defaults in code.
my $anvil = Anvil::Tools->new(); my $anvil = Anvil::Tools->new();
# If we can connect to a database, we'll set/clear the 'migrating' flag during migrations. For timing reasons
# we don't let the RA do resyncs.
$anvil->Database->connect({no_resync => 1});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0132"});
if (not $anvil->data->{sys}{database}{connections})
{
# No databases, we're only going to be able to do status checks..
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, secure => 0, key => "warning_0073"});
}
### Read or Set the environment variables ### Read or Set the environment variables
# This is the name of the server we're managing. # Example values: # This is the name of the server we're managing. # Example values:
$anvil->data->{environment}{OCF_RESKEY_name} = defined $ENV{OCF_RESKEY_name} ? $ENV{OCF_RESKEY_name} : ""; $anvil->data->{environment}{OCF_RESKEY_name} = defined $ENV{OCF_RESKEY_name} ? $ENV{OCF_RESKEY_name} : "";
@ -117,20 +107,20 @@ $anvil->data->{environment}{OCF_RESKEY_CRM_meta_on_node_uuid} = defined $ENV{O
# This is the timeout for the called action in millisecond. # This is the timeout for the called action in millisecond.
$anvil->data->{environment}{OCF_RESKEY_CRM_meta_timeout} = defined $ENV{OCF_RESKEY_CRM_meta_timeout} ? $ENV{OCF_RESKEY_CRM_meta_timeout} : ""; # 20000 $anvil->data->{environment}{OCF_RESKEY_CRM_meta_timeout} = defined $ENV{OCF_RESKEY_CRM_meta_timeout} ? $ENV{OCF_RESKEY_CRM_meta_timeout} : ""; # 20000
# If this is set, we'll bump our log level as well. # If this is set, we'll bump our log level as well.
$anvil->data->{environment}{PCMK_debug} = defined $ENV{PCMK_debug} ? $ENV{PCMK_debug} : ""; # 0 $anvil->data->{environment}{PCMK_debug} = defined $ENV{PCMK_debug} ? $ENV{PCMK_debug} : "0"; # Disable debug by default
# These are other variables that are set, but we don't currently care about them # These are other variables that are set, but we don't currently care about them
$anvil->data->{environment}{OCF_EXIT_REASON_PREFIX} = defined $ENV{OCF_EXIT_REASON_PREFIX} ? $ENV{OCF_EXIT_REASON_PREFIX} : ""; # ocf-exit-reason: $anvil->data->{environment}{OCF_EXIT_REASON_PREFIX} = defined $ENV{OCF_EXIT_REASON_PREFIX} ? $ENV{OCF_EXIT_REASON_PREFIX} : "ocf-exit-reason:";
$anvil->data->{environment}{OCF_RA_VERSION_MAJOR} = defined $ENV{OCF_RA_VERSION_MAJOR} ? $ENV{OCF_RA_VERSION_MAJOR} : ""; # 1 $anvil->data->{environment}{OCF_RA_VERSION_MAJOR} = defined $ENV{OCF_RA_VERSION_MAJOR} ? $ENV{OCF_RA_VERSION_MAJOR} : ""; # 1
$anvil->data->{environment}{OCF_RA_VERSION_MINOR} = defined $ENV{OCF_RA_VERSION_MINOR} ? $ENV{OCF_RA_VERSION_MINOR} : ""; # 0 $anvil->data->{environment}{OCF_RA_VERSION_MINOR} = defined $ENV{OCF_RA_VERSION_MINOR} ? $ENV{OCF_RA_VERSION_MINOR} : ""; # 0
$anvil->data->{environment}{OCF_RESKEY_crm_feature_set} = defined $ENV{OCF_RESKEY_crm_feature_set} ? $ENV{OCF_RESKEY_crm_feature_set} : ""; # 3.0.12 $anvil->data->{environment}{OCF_RESKEY_crm_feature_set} = defined $ENV{OCF_RESKEY_crm_feature_set} ? $ENV{OCF_RESKEY_crm_feature_set} : ""; # Pacemaker OCF version - 3.7.1
$anvil->data->{environment}{OCF_RESOURCE_INSTANCE} = defined $ENV{OCF_RESOURCE_INSTANCE} ? $ENV{OCF_RESOURCE_INSTANCE} : ""; # srv01-c7 $anvil->data->{environment}{OCF_RESOURCE_INSTANCE} = defined $ENV{OCF_RESOURCE_INSTANCE} ? $ENV{OCF_RESOURCE_INSTANCE} : ""; # Name of server / resource being acted on.
$anvil->data->{environment}{OCF_RESOURCE_PROVIDER} = defined $ENV{OCF_RESOURCE_PROVIDER} ? $ENV{OCF_RESOURCE_PROVIDER} : ""; # alteeve $anvil->data->{environment}{OCF_RESOURCE_PROVIDER} = defined $ENV{OCF_RESOURCE_PROVIDER} ? $ENV{OCF_RESOURCE_PROVIDER} : "alteeve";
$anvil->data->{environment}{OCF_RESOURCE_TYPE} = defined $ENV{OCF_RESOURCE_TYPE} ? $ENV{OCF_RESOURCE_TYPE} : ""; # server $anvil->data->{environment}{OCF_RESOURCE_TYPE} = defined $ENV{OCF_RESOURCE_TYPE} ? $ENV{OCF_RESOURCE_TYPE} : "server";
$anvil->data->{environment}{OCF_ROOT} = defined $ENV{OCF_ROOT} ? $ENV{OCF_ROOT} : ""; # /usr/lib/ocf $anvil->data->{environment}{OCF_ROOT} = defined $ENV{OCF_ROOT} ? $ENV{OCF_ROOT} : "/usr/lib/ocf";
# These are set during a migration # These are set during a migration
$anvil->data->{environment}{OCF_RESKEY_CRM_meta_migrate_source} = defined $ENV{OCF_RESKEY_CRM_meta_migrate_source} ? $ENV{OCF_RESKEY_CRM_meta_migrate_source} : ""; # mk-a02n01.digimer.ca $anvil->data->{environment}{OCF_RESKEY_CRM_meta_migrate_source} = defined $ENV{OCF_RESKEY_CRM_meta_migrate_source} ? $ENV{OCF_RESKEY_CRM_meta_migrate_source} : "";
$anvil->data->{environment}{OCF_RESKEY_CRM_meta_migrate_target} = defined $ENV{OCF_RESKEY_CRM_meta_migrate_target} ? $ENV{OCF_RESKEY_CRM_meta_migrate_target} : ""; # mk-a02n02.digimer.ca $anvil->data->{environment}{OCF_RESKEY_CRM_meta_migrate_target} = defined $ENV{OCF_RESKEY_CRM_meta_migrate_target} ? $ENV{OCF_RESKEY_CRM_meta_migrate_target} : "";
$anvil->data->{environment}{OCF_RESKEY_CRM_meta_record_pending} = defined $ENV{OCF_RESKEY_CRM_meta_record_pending} ? $ENV{OCF_RESKEY_CRM_meta_record_pending} : ""; # true $anvil->data->{environment}{OCF_RESKEY_CRM_meta_record_pending} = defined $ENV{OCF_RESKEY_CRM_meta_record_pending} ? $ENV{OCF_RESKEY_CRM_meta_record_pending} : "";
# Any variable=value arguments in the resource are set under 'OCF_RESKEY_CRM_meta_' # Any variable=value arguments in the resource are set under 'OCF_RESKEY_CRM_meta_'
foreach my $key (sort {$a cmp $b} keys %ENV) foreach my $key (sort {$a cmp $b} keys %ENV)
{ {
@ -156,7 +146,28 @@ $anvil->data->{environment}{OCF_RESKEY_CRM_meta_stop_drbd_resources} = 0;
$anvil->data->{switches}{migrate_to} = ""; # Sets 'meta_migrate_target' $anvil->data->{switches}{migrate_to} = ""; # Sets 'meta_migrate_target'
$anvil->data->{switches}{migrate_from} = ""; # Sets 'meta_migrate_source' When set without 'migrate_to', does a status check after migration $anvil->data->{switches}{migrate_from} = ""; # Sets 'meta_migrate_source' When set without 'migrate_to', does a status check after migration
$anvil->data->{switches}{server} = ""; # Sets 'name'. $anvil->data->{switches}{server} = ""; # Sets 'name'.
$anvil->data->{switches}{start} = "";
$anvil->data->{switches}{stop} = "";
$anvil->data->{switches}{monitor} = "";
$anvil->Get->switches(); $anvil->Get->switches();
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"switches::migrate_to" => $anvil->data->{switches}{migrate_to},
"switches::migrate_from" => $anvil->data->{switches}{migrate_from},
"switches::server" => $anvil->data->{switches}{server},
"switches::start" => $anvil->data->{switches}{start},
"switches::stop" => $anvil->data->{switches}{stop},
"switches::monitor" => $anvil->data->{switches}{monitor},
}});
# If we can connect to a database, we'll set/clear the 'migrating' flag during migrations. For timing reasons
# we don't let the RA do resyncs.
$anvil->Database->connect({sensitive => 1});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0132"});
if (not $anvil->data->{sys}{database}{connections})
{
# No databases,
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, secure => 0, key => "warning_0073"});
}
if ($anvil->data->{switches}{stop_drbd_resources}) if ($anvil->data->{switches}{stop_drbd_resources})
{ {
@ -164,36 +175,187 @@ if ($anvil->data->{switches}{stop_drbd_resources})
} }
# Something for the logs # Something for the logs
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 0, level => 3, key => "log_0298"}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 0, level => 2, key => "log_0298"});
=cut =cut
Start:
environment::OCF_RESKEY_CRM_meta_migrate_source: []
environment::OCF_RESKEY_CRM_meta_migrate_target: []
environment::OCF_RESKEY_CRM_meta_name: [start]
environment::OCF_RESKEY_CRM_meta_on_fail: [block]
environment::OCF_RESKEY_CRM_meta_on_node: [an-a02n01]
environment::OCF_RESKEY_CRM_meta_on_node_uuid: [1]
environment::OCF_RESKEY_CRM_meta_record_pending: []
environment::OCF_RESKEY_CRM_meta_stop_drbd_resources: [0]
environment::OCF_RESKEY_CRM_meta_timeout: [300000]
environment::OCF_RESKEY_name: [srv02-c8s-fujitsu]
environment::OCF_RESOURCE_INSTANCE: [srv02-c8s-fujitsu]
environment::OCF_ROOT: [/usr/lib/ocf]
Monitor after start:
environment::OCF_RESKEY_CRM_meta_interval: [60000]
environment::OCF_RESKEY_CRM_meta_migrate_source: []
environment::OCF_RESKEY_CRM_meta_migrate_target: []
environment::OCF_RESKEY_CRM_meta_name: [monitor]
environment::OCF_RESKEY_CRM_meta_on_node: [an-a02n01]
environment::OCF_RESKEY_CRM_meta_on_node_uuid: [1]
environment::OCF_RESKEY_CRM_meta_record_pending: []
environment::OCF_RESKEY_CRM_meta_stop_drbd_resources: [0]
environment::OCF_RESKEY_CRM_meta_timeout: [20000]
environment::OCF_RESKEY_name: [srv02-c8s-fujitsu]
environment::OCF_RESOURCE_INSTANCE: [srv02-c8s-fujitsu]
environment::OCF_ROOT: [/usr/lib/ocf]
Monitor one minute later:
environment::OCF_RESKEY_CRM_meta_interval: [60000]
environment::OCF_RESKEY_CRM_meta_migrate_source: []
environment::OCF_RESKEY_CRM_meta_migrate_target: []
environment::OCF_RESKEY_CRM_meta_name: [monitor]
environment::OCF_RESKEY_CRM_meta_on_node: [an-a02n01]
environment::OCF_RESKEY_CRM_meta_on_node_uuid: [1]
environment::OCF_RESKEY_CRM_meta_record_pending: []
environment::OCF_RESKEY_CRM_meta_stop_drbd_resources: [0]
environment::OCF_RESKEY_CRM_meta_timeout: [20000]
environment::OCF_RESKEY_name: [srv02-c8s-fujitsu]
environment::OCF_RESOURCE_INSTANCE: [srv02-c8s-fujitsu]
environment::OCF_ROOT: [/usr/lib/ocf]
Migrate from an-a02n01 to an-a02n02
environment::OCF_RESKEY_CRM_meta_interval: [60000]
environment::OCF_RESKEY_CRM_meta_migrate_source: []
environment::OCF_RESKEY_CRM_meta_migrate_target: []
environment::OCF_RESKEY_CRM_meta_name: [monitor]
environment::OCF_RESKEY_CRM_meta_on_node: [an-a02n01]
environment::OCF_RESKEY_CRM_meta_on_node_uuid: [1]
environment::OCF_RESKEY_CRM_meta_record_pending: []
environment::OCF_RESKEY_CRM_meta_stop_drbd_resources: [0]
environment::OCF_RESKEY_CRM_meta_timeout: [20000]
environment::OCF_RESKEY_name: [srv02-c8s-fujitsu]
environment::OCF_RESOURCE_INSTANCE: [srv02-c8s-fujitsu]
environment::OCF_ROOT: [/usr/lib/ocf]
<2 seconds later>
environment::OCF_RESKEY_CRM_meta_migrate_source: [an-a02n01]
environment::OCF_RESKEY_CRM_meta_migrate_target: [an-a02n02]
environment::OCF_RESKEY_CRM_meta_name: [migrate_to]
environment::OCF_RESKEY_CRM_meta_on_node: [an-a02n01]
environment::OCF_RESKEY_CRM_meta_on_node_uuid: [1]
environment::OCF_RESKEY_CRM_meta_record_pending: [true]
environment::OCF_RESKEY_CRM_meta_stop_drbd_resources: [0]
environment::OCF_RESKEY_CRM_meta_timeout: [86400000]
environment::OCF_RESKEY_name: [srv02-c8s-fujitsu]
environment::OCF_RESOURCE_INSTANCE: [srv02-c8s-fujitsu]
environment::OCF_ROOT: [/usr/lib/ocf]
Post migration on an-a02n01
environment::OCF_RESKEY_CRM_meta_migrate_source: []
environment::OCF_RESKEY_CRM_meta_migrate_target: []
environment::OCF_RESKEY_CRM_meta_name: [stop]
environment::OCF_RESKEY_CRM_meta_on_fail: [block]
environment::OCF_RESKEY_CRM_meta_on_node: [an-a02n01]
environment::OCF_RESKEY_CRM_meta_on_node_uuid: [1]
environment::OCF_RESKEY_CRM_meta_record_pending: []
environment::OCF_RESKEY_CRM_meta_stop_drbd_resources: [0]
environment::OCF_RESKEY_CRM_meta_timeout: [86400000]
environment::OCF_RESKEY_name: [srv02-c8s-fujitsu]
environment::OCF_RESOURCE_INSTANCE: [srv02-c8s-fujitsu]
environment::PCMK_debug: [0]
Post migration on an-a02n02
environment::OCF_RESKEY_CRM_meta_migrate_source: [an-a02n01]
environment::OCF_RESKEY_CRM_meta_migrate_target: [an-a02n02]
environment::OCF_RESKEY_CRM_meta_name: [migrate_from]
environment::OCF_RESKEY_CRM_meta_on_node: [an-a02n02]
environment::OCF_RESKEY_CRM_meta_on_node_uuid: [2]
environment::OCF_RESKEY_CRM_meta_record_pending: []
environment::OCF_RESKEY_CRM_meta_stop_drbd_resources: [0]
environment::OCF_RESKEY_CRM_meta_timeout: [600000]
environment::OCF_RESKEY_name: [srv02-c8s-fujitsu]
environment::OCF_RESOURCE_INSTANCE: [srv02-c8s-fujitsu]
environment::OCF_RESOURCE_PROVIDER: [alteeve]
environment::OCF_RESOURCE_TYPE: [server]
environment::OCF_ROOT: [/usr/lib/ocf]
environment::PCMK_debug: [0]
Checking server state after: [srv02-c8s-fujitsu] was migrated to this host.
environment::OCF_EXIT_REASON_PREFIX: [ocf-exit-reason:]
environment::OCF_RA_VERSION_MAJOR: [1]
environment::OCF_RA_VERSION_MINOR: [0]
environment::OCF_RESKEY_CRM_meta_interval: [60000]
environment::OCF_RESKEY_CRM_meta_migrate_source: []
environment::OCF_RESKEY_CRM_meta_migrate_target: []
environment::OCF_RESKEY_CRM_meta_name: [monitor]
environment::OCF_RESKEY_CRM_meta_on_node: [an-a02n02]
environment::OCF_RESKEY_CRM_meta_on_node_uuid: [2]
environment::OCF_RESKEY_CRM_meta_record_pending: []
environment::OCF_RESKEY_CRM_meta_stop_drbd_resources: [0]
environment::OCF_RESKEY_CRM_meta_timeout: [20000]
environment::OCF_RESKEY_crm_feature_set: [3.7.1]
environment::OCF_RESKEY_name: [srv02-c8s-fujitsu]
environment::OCF_RESOURCE_INSTANCE: [srv02-c8s-fujitsu]
environment::OCF_RESOURCE_PROVIDER: [alteeve]
environment::OCF_RESOURCE_TYPE: [server]
environment::OCF_ROOT: [/usr/lib/ocf]
environment::PCMK_debug: [0]
server --server Monitor on an-a02n02 after a minute
-=] Boot (on an-a01n01)
2021/04/17 18:41:30:ocf:alteeve:server:236; environment::OCF_RESKEY_CRM_meta_name: [start]
2021/04/17 18:41:30:ocf:alteeve:server:236; environment::OCF_RESKEY_CRM_meta_on_node: [an-a01n01]
-=] Stop (on an-a01n01) environment::OCF_EXIT_REASON_PREFIX: [ocf-exit-reason:]
2021/04/17 18:33:50:ocf:alteeve:server:236; environment::OCF_RESKEY_CRM_meta_name: [stop] environment::OCF_RA_VERSION_MAJOR: [1]
2021/04/17 18:33:50:ocf:alteeve:server:236; environment::OCF_RESKEY_CRM_meta_on_node: [an-a01n01] environment::OCF_RA_VERSION_MINOR: [0]
environment::OCF_RESKEY_CRM_meta_interval: [60000]
environment::OCF_RESKEY_CRM_meta_migrate_source: []
environment::OCF_RESKEY_CRM_meta_migrate_target: []
environment::OCF_RESKEY_CRM_meta_name: [monitor]
environment::OCF_RESKEY_CRM_meta_on_node: [an-a02n02]
environment::OCF_RESKEY_CRM_meta_on_node_uuid: [2]
environment::OCF_RESKEY_CRM_meta_record_pending: []
environment::OCF_RESKEY_CRM_meta_stop_drbd_resources: [0]
environment::OCF_RESKEY_CRM_meta_timeout: [20000]
environment::OCF_RESKEY_crm_feature_set: [3.7.1]
environment::OCF_RESKEY_name: [srv02-c8s-fujitsu]
environment::OCF_RESOURCE_INSTANCE: [srv02-c8s-fujitsu]
environment::OCF_RESOURCE_PROVIDER: [alteeve]
environment::OCF_RESOURCE_TYPE: [server]
environment::OCF_ROOT: [/usr/lib/ocf]
environment::PCMK_debug: [0]
-=] Migration - source (before - from an-a01n01)
2021/04/17 19:33:12:ocf:alteeve:server:196; environment::OCF_RESKEY_CRM_meta_migrate_source: [an-a01n01]
2021/04/17 19:33:12:ocf:alteeve:server:196; environment::OCF_RESKEY_CRM_meta_migrate_target: [an-a01n02]
2021/04/17 19:33:12:ocf:alteeve:server:196; environment::OCF_RESKEY_CRM_meta_name: [migrate_to]
2021/04/17 19:33:12:ocf:alteeve:server:196; environment::OCF_RESKEY_CRM_meta_on_node: [an-a01n01]
-=] Migration - target (after - to an-a01n02) Stop server:
2021/04/17 19:33:19:ocf:alteeve:server:196; environment::OCF_RESKEY_CRM_meta_migrate_source: [an-a01n01]
2021/04/17 19:33:19:ocf:alteeve:server:196; environment::OCF_RESKEY_CRM_meta_migrate_target: [an-a01n02] environment::OCF_EXIT_REASON_PREFIX: [ocf-exit-reason:]
2021/04/17 19:33:19:ocf:alteeve:server:196; environment::OCF_RESKEY_CRM_meta_name: [migrate_from] environment::OCF_RA_VERSION_MAJOR: [1]
2021/04/17 19:33:19:ocf:alteeve:server:196; environment::OCF_RESKEY_CRM_meta_on_node: [an-a01n02] environment::OCF_RA_VERSION_MINOR: [0]
environment::OCF_RESKEY_CRM_meta_migrate_source: []
environment::OCF_RESKEY_CRM_meta_migrate_target: []
environment::OCF_RESKEY_CRM_meta_name: [stop]
environment::OCF_RESKEY_CRM_meta_on_fail: [block]
environment::OCF_RESKEY_CRM_meta_on_node: [an-a02n02]
environment::OCF_RESKEY_CRM_meta_on_node_uuid: [2]
environment::OCF_RESKEY_CRM_meta_record_pending: []
environment::OCF_RESKEY_CRM_meta_stop_drbd_resources: [0]
environment::OCF_RESKEY_CRM_meta_timeout: [86400000]
environment::OCF_RESKEY_crm_feature_set: [3.7.1]
environment::OCF_RESKEY_name: [srv02-c8s-fujitsu]
environment::OCF_RESOURCE_INSTANCE: [srv02-c8s-fujitsu]
environment::OCF_RESOURCE_PROVIDER: [alteeve]
environment::OCF_RESOURCE_TYPE: [server]
environment::OCF_ROOT: [/usr/lib/ocf]
environment::PCMK_debug: [0]
=cut =cut
foreach my $key (sort {$a cmp $b} keys %{$anvil->data->{environment}}) foreach my $key (sort {$a cmp $b} keys %{$anvil->data->{environment}})
{ {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"environment::${key}" => $anvil->data->{environment}{$key}, "environment::${key}" => $anvil->data->{environment}{$key},
}}); }});
} }
@ -336,7 +498,7 @@ sub check_daemons
# Is the peer running? We'll use this to know whether to try and start daemons on the peer. # Is the peer running? We'll use this to know whether to try and start daemons on the peer.
my $peer_name = $anvil->data->{cib}{parsed}{peer}{name}; my $peer_name = $anvil->data->{cib}{parsed}{peer}{name};
my $peer_ready = $anvil->data->{cib}{parsed}{peer}{ready}; my $peer_ready = $anvil->data->{cib}{parsed}{peer}{ready};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
peer_name => $peer_name, peer_name => $peer_name,
peer_ready => $peer_ready, peer_ready => $peer_ready,
}}); }});
@ -351,7 +513,7 @@ sub check_daemons
my $running_peer = 0; my $running_peer = 0;
my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{systemctl}." status ".$daemon}); my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{systemctl}." status ".$daemon});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
output => $output, output => $output,
return_code => $return_code, return_code => $return_code,
}}); }});
@ -360,7 +522,7 @@ sub check_daemons
# It is stopped, start it.. # It is stopped, start it..
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0482", variables => { daemon => $daemon }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0482", variables => { daemon => $daemon }});
my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{systemctl}." start ".$daemon}); my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{systemctl}." start ".$daemon});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
output => $output, output => $output,
return_code => $return_code, return_code => $return_code,
}}); }});
@ -370,7 +532,7 @@ sub check_daemons
until ($running) until ($running)
{ {
my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{systemctl}." status ".$daemon}); my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{systemctl}." status ".$daemon});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
output => $output, output => $output,
return_code => $return_code, return_code => $return_code,
}}); }});
@ -410,7 +572,7 @@ sub check_daemons
target => $peer_name, target => $peer_name,
shell_call => $anvil->data->{path}{exe}{systemctl}." status ".$daemon, shell_call => $anvil->data->{path}{exe}{systemctl}." status ".$daemon,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
output => $output, output => $output,
error => $error, error => $error,
return_code => $return_code, return_code => $return_code,
@ -426,7 +588,7 @@ sub check_daemons
target => $peer_name, target => $peer_name,
shell_call => $anvil->data->{path}{exe}{systemctl}." start ".$daemon, shell_call => $anvil->data->{path}{exe}{systemctl}." start ".$daemon,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
output => $output, output => $output,
error => $error, error => $error,
return_code => $return_code, return_code => $return_code,
@ -440,7 +602,7 @@ sub check_daemons
target => $peer_name, target => $peer_name,
shell_call => $anvil->data->{path}{exe}{systemctl}." status ".$daemon, shell_call => $anvil->data->{path}{exe}{systemctl}." status ".$daemon,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
output => $output, output => $output,
error => $error, error => $error,
return_code => $return_code, return_code => $return_code,
@ -503,7 +665,7 @@ sub check_daemons
# Call virsh list --all # Call virsh list --all
my ($local_output, $local_return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{virsh}." list --all"}); my ($local_output, $local_return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{virsh}." list --all"});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
local_output => $local_output, local_output => $local_output,
local_return_code => $local_return_code, local_return_code => $local_return_code,
}}); }});
@ -513,12 +675,12 @@ sub check_daemons
foreach my $line (split/\n/, $local_output) foreach my $line (split/\n/, $local_output)
{ {
$line = $anvil->Words->clean_spaces({ string => $line }); $line = $anvil->Words->clean_spaces({ string => $line });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { line => $line }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }});
if ($line =~ /(\d+)\s+(.*?)\s+running/) if ($line =~ /(\d+)\s+(.*?)\s+running/)
{ {
$local_vm_count++; $local_vm_count++;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { local_vm_count => $local_vm_count }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { local_vm_count => $local_vm_count }});
} }
} }
} }
@ -527,7 +689,7 @@ sub check_daemons
target => $peer_name, target => $peer_name,
shell_call => $anvil->data->{path}{exe}{virsh}." list --all", shell_call => $anvil->data->{path}{exe}{virsh}." list --all",
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
remote_output => $remote_output, remote_output => $remote_output,
remote_error => $remote_error, remote_error => $remote_error,
remote_return_code => $remote_return_code, remote_return_code => $remote_return_code,
@ -538,17 +700,17 @@ sub check_daemons
foreach my $line (split/\n/, $remote_output) foreach my $line (split/\n/, $remote_output)
{ {
$line = $anvil->Words->clean_spaces({ string => $line }); $line = $anvil->Words->clean_spaces({ string => $line });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { line => $line }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }});
if ($line =~ /(\d+)\s+(.*?)\s+running/) if ($line =~ /(\d+)\s+(.*?)\s+running/)
{ {
$remote_vm_count++; $remote_vm_count++;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { remote_vm_count => $remote_vm_count }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { remote_vm_count => $remote_vm_count }});
} }
} }
} }
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
local_vm_count => $local_vm_count, local_vm_count => $local_vm_count,
remote_vm_count => $remote_vm_count, remote_vm_count => $remote_vm_count,
}}); }});
@ -570,7 +732,7 @@ sub check_daemons
my $running_peer = 0; my $running_peer = 0;
my ($local_output, $local_return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{systemctl}." status ".$daemon}); my ($local_output, $local_return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{systemctl}." status ".$daemon});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
local_output => $local_output, local_output => $local_output,
local_return_code => $local_return_code, local_return_code => $local_return_code,
}}); }});
@ -584,7 +746,7 @@ sub check_daemons
# Running, stop it. # Running, stop it.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0493", variables => { daemon => $daemon }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0493", variables => { daemon => $daemon }});
my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{systemctl}." stop ".$daemon}); my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{systemctl}." stop ".$daemon});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
output => $output, output => $output,
return_code => $return_code, return_code => $return_code,
}}); }});
@ -594,7 +756,7 @@ sub check_daemons
target => $peer_name, target => $peer_name,
shell_call => $anvil->data->{path}{exe}{systemctl}." status ".$daemon, shell_call => $anvil->data->{path}{exe}{systemctl}." status ".$daemon,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
remote_output => $remote_output, remote_output => $remote_output,
remote_error => $remote_error, remote_error => $remote_error,
remote_return_code => $remote_return_code, remote_return_code => $remote_return_code,
@ -618,7 +780,7 @@ sub check_daemons
target => $peer_name, target => $peer_name,
shell_call => $anvil->data->{path}{exe}{systemctl}." stop ".$daemon, shell_call => $anvil->data->{path}{exe}{systemctl}." stop ".$daemon,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
output => $output, output => $output,
error => $error, error => $error,
return_code => $return_code, return_code => $return_code,
@ -994,7 +1156,7 @@ sub stop_server
} }
# Now stop the DRBD resource(s). # Now stop the DRBD resource(s).
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
'environment::OCF_RESKEY_CRM_meta_stop_drbd_resources' => $anvil->data->{environment}{OCF_RESKEY_CRM_meta_stop_drbd_resources}, 'environment::OCF_RESKEY_CRM_meta_stop_drbd_resources' => $anvil->data->{environment}{OCF_RESKEY_CRM_meta_stop_drbd_resources},
}}); }});
if ($anvil->data->{environment}{OCF_RESKEY_CRM_meta_stop_drbd_resources}) if ($anvil->data->{environment}{OCF_RESKEY_CRM_meta_stop_drbd_resources})
@ -1011,8 +1173,6 @@ sub server_status
{ {
my ($anvil) = @_; my ($anvil) = @_;
### NOTE: This method MUST always work, even without access to databases!
# If the named server is running, return OCF_SUCCESS (rc: 0), otherwise OCF_NOT_RUNNING (rc: 7). If # If the named server is running, return OCF_SUCCESS (rc: 0), otherwise OCF_NOT_RUNNING (rc: 7). If
# the server is failed, return OCF_ERR_GENERIC (1). # the server is failed, return OCF_ERR_GENERIC (1).
my $state = ""; my $state = "";
@ -1035,11 +1195,11 @@ sub server_status
while($libvirtd_wait) while($libvirtd_wait)
{ {
my $running = $anvil->System->check_daemon({daemon => "libvirtd.service"}); my $running = $anvil->System->check_daemon({daemon => "libvirtd.service"});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { running => $running }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { running => $running }});
if ($running) if ($running)
{ {
$libvirtd_wait = 0; $libvirtd_wait = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { libvirtd_wait => $libvirtd_wait }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { libvirtd_wait => $libvirtd_wait }});
} }
else else
{ {
@ -1056,7 +1216,7 @@ sub server_status
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "warning_0057"}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "warning_0057"});
$look_for_pid = 1; $look_for_pid = 1;
$libvirtd_wait = 0; $libvirtd_wait = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
look_for_pid => $look_for_pid, look_for_pid => $look_for_pid,
libvirtd_wait => $libvirtd_wait, libvirtd_wait => $libvirtd_wait,
}}); }});
@ -1069,10 +1229,10 @@ sub server_status
{ {
my $server_up = 0; my $server_up = 0;
my $shell_call = $anvil->data->{path}{exe}{ps}." aux"; my $shell_call = $anvil->data->{path}{exe}{ps}." aux";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { shell_call => $shell_call }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }});
my ($output, $return_code) = $anvil->System->call({shell_call => $shell_call}); my ($output, $return_code) = $anvil->System->call({shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
output => $output, output => $output,
return_code => $return_code, return_code => $return_code,
}}); }});
@ -1081,18 +1241,18 @@ sub server_status
next if $line !~ /qemu-kvm/; next if $line !~ /qemu-kvm/;
$line = $anvil->Words->clean_spaces({ string => $line }); $line = $anvil->Words->clean_spaces({ string => $line });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { line => $line }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }});
if ($line =~ /guest=(.*?),/) if ($line =~ /guest=(.*?),/)
{ {
my $this_server = $1; my $this_server = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { this_server => $this_server }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { this_server => $this_server }});
if ($this_server eq $server) if ($this_server eq $server)
{ {
# Found it. # Found it.
$server_up = 1; $server_up = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { server_up => $server_up }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { server_up => $server_up }});
last; last;
} }
} }
@ -1122,23 +1282,23 @@ sub server_status
$loop = 0; $loop = 0;
my $found = 0; my $found = 0;
my $shell_call = $anvil->data->{path}{exe}{virsh}." list --all"; my $shell_call = $anvil->data->{path}{exe}{virsh}." list --all";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { shell_call => $shell_call }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }});
my ($output, $return_code) = $anvil->System->call({shell_call => $shell_call}); my ($output, $return_code) = $anvil->System->call({shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
output => $output, output => $output,
return_code => $return_code, return_code => $return_code,
}}); }});
foreach my $line (split/\n/, $output) foreach my $line (split/\n/, $output)
{ {
$line = $anvil->Words->clean_spaces({ string => $line }); $line = $anvil->Words->clean_spaces({ string => $line });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { line => $line }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }});
if ($line =~ /\s\Q$server\E\s+(.*)/) if ($line =~ /\s\Q$server\E\s+(.*)/)
{ {
my $state = $1; my $state = $1;
$found = 1; $found = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
found => $found, found => $found,
'state' => $state, 'state' => $state,
}}); }});
@ -1202,18 +1362,23 @@ pmsuspended - The domain has been suspended by guest power management, e.g. ente
$anvil->nice_exit({exit_code => 1}); $anvil->nice_exit({exit_code => 1});
} }
### TODO: Write the migration duration to /tmp/anvil.migration.<server>.data and have 'anvil-migrate-server' read that in to update the DB.
# Migrate the server # Migrate the server
sub migrate_server sub migrate_server
{ {
my ($anvil) = @_; my ($anvil) = @_;
# This requires a database ### This requires a database
if (not $anvil->data->{sys}{database}{connections}) # If we can connect to a database, we'll set/clear the 'migrating' flag during migrations. For timing
{ # reasons we don't let the RA do resyncs.
# No databases, exit. # $anvil->Database->connect({sensitive => 1});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, secure => 0, key => "error_0003"}); # $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0132"});
return(1); # if (not $anvil->data->{sys}{database}{connections})
} # {
# # No databases, exit.
# $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, secure => 0, key => "error_0003"});
# return(1);
# }
### NOTE: For now, we're not going to block if the target is not UpToDate. There are times when a ### NOTE: For now, we're not going to block if the target is not UpToDate. There are times when a
### user might want to do this (ie: sync will be done soon and the need to evacuate the node ### user might want to do this (ie: sync will be done soon and the need to evacuate the node
@ -1309,7 +1474,7 @@ sub migrate_server
$anvil->nice_exit({exit_code => 1}); $anvil->nice_exit({exit_code => 1});
} }
# Get a view of the servers locally and our peer. # Get a view of the servers locally and on our peer.
validate_all($anvil); validate_all($anvil);
# Get the DRBD status. # Get the DRBD status.
@ -1558,7 +1723,7 @@ sub validate_bridges
if ($found) if ($found)
{ {
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0368", variables => { bridge => $bridge }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0368", variables => { bridge => $bridge }});
} }
else else
{ {
@ -1590,7 +1755,7 @@ sub validate_storage
{ {
$xml_source = "from_virsh"; $xml_source = "from_virsh";
} }
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
server => $server, server => $server,
xml_source => $xml_source, xml_source => $xml_source,
}}); }});
@ -1729,7 +1894,7 @@ sub validate_emulator
my $local_host = $anvil->Get->short_host_name(); my $local_host = $anvil->Get->short_host_name();
my $server = $anvil->data->{environment}{OCF_RESKEY_name}; my $server = $anvil->data->{environment}{OCF_RESKEY_name};
my $emulator = $anvil->data->{server}{$local_host}{$server}{from_disk}{info}{emulator}; my $emulator = $anvil->data->{server}{$local_host}{$server}{from_disk}{info}{emulator};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
emulator => $emulator, emulator => $emulator,
"server::${local_host}::${server}::from_disk::info::emulator" => $anvil->data->{server}{$local_host}{$server}{from_disk}{info}{emulator} "server::${local_host}::${server}::from_disk::info::emulator" => $anvil->data->{server}{$local_host}{$server}{from_disk}{info}{emulator}
}}); }});
@ -1760,7 +1925,7 @@ sub validate_name
my $local_host = $anvil->Get->short_host_name(); my $local_host = $anvil->Get->short_host_name();
my $server = $anvil->data->{environment}{OCF_RESKEY_name}; my $server = $anvil->data->{environment}{OCF_RESKEY_name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
server => $server, server => $server,
"server::${local_host}::${server}::from_disk::info::name" => $anvil->data->{server}{$local_host}{$server}{from_disk}{info}{name}, "server::${local_host}::${server}::from_disk::info::name" => $anvil->data->{server}{$local_host}{$server}{from_disk}{info}{name},
}}); }});
@ -1799,7 +1964,7 @@ sub validate_ram
my $server = $anvil->data->{environment}{OCF_RESKEY_name}; my $server = $anvil->data->{environment}{OCF_RESKEY_name};
my $server_ram_bytes = $anvil->data->{server}{$local_host}{$server}{from_disk}{memory}; my $server_ram_bytes = $anvil->data->{server}{$local_host}{$server}{from_disk}{memory};
my $available = $anvil->Get->free_memory({debug => 3}); my $available = $anvil->Get->free_memory({debug => 3});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
server_ram_bytes => $anvil->Convert->add_commas({number => $server_ram_bytes})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $server_ram_bytes}).")", server_ram_bytes => $anvil->Convert->add_commas({number => $server_ram_bytes})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $server_ram_bytes}).")",
available => $anvil->Convert->add_commas({number => $available})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $available}).")", available => $anvil->Convert->add_commas({number => $available})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $available}).")",
}}); }});
@ -1838,7 +2003,7 @@ sub read_server_definition
my ($anvil) = @_; my ($anvil) = @_;
my $server = $anvil->data->{environment}{OCF_RESKEY_name}; my $server = $anvil->data->{environment}{OCF_RESKEY_name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
server => $server, server => $server,
}}); }});

@ -1801,6 +1801,11 @@ The file: [#!variable!file!#] needs to be updated. The difference is:
<key name="log_0622">Aging out one or more records that are more than: [#!variable!age!#] hours old from the table: [#!variable!table!#] on the database host: [#!variable!database!#].</key> <key name="log_0622">Aging out one or more records that are more than: [#!variable!age!#] hours old from the table: [#!variable!table!#] on the database host: [#!variable!database!#].</key>
<key name="log_0623">Starting the process of aging out old data. This can take about a minute, please be patient.</key> <key name="log_0623">Starting the process of aging out old data. This can take about a minute, please be patient.</key>
<key name="log_0624">Aging out old data completed after: [#!variable!runtime!#] seconds.</key> <key name="log_0624">Aging out old data completed after: [#!variable!runtime!#] seconds.</key>
<key name="log_0625">Updating the apache configuration file: [#!variable!file!#]. The changes are:
====
#!variable!difference!#
====
</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>
@ -2470,6 +2475,8 @@ If you are comfortable that the target has changed for a known reason, you can s
<key name="striker_0285">Close</key> <key name="striker_0285">Close</key>
<key name="striker_0286">This controls if 'anvil-safe-start' is enabled on a node.</key> <key name="striker_0286">This controls if 'anvil-safe-start' is enabled on a node.</key>
<key name="striker_0287">The virtio NAT bridge: [#!variable!bridge!#] exists. Removing it...</key> <key name="striker_0287">The virtio NAT bridge: [#!variable!bridge!#] exists. Removing it...</key>
<key name="striker_0288">Manage existing Anvil! systems.</key>
<key name="striker_0289">Control when the database is locked for use by any system except the lock holder.</key>
<!-- These are generally units and appended to numbers --> <!-- These are generally units and appended to numbers -->
<key name="suffix_0001">#!variable!number!#/sec</key> <key name="suffix_0001">#!variable!number!#/sec</key>

@ -263,6 +263,12 @@ sub reconfigure_network
# Get the current list of IPs and MAC addresses. # Get the current list of IPs and MAC addresses.
$anvil->Network->get_ips({debug => 3}); $anvil->Network->get_ips({debug => 3});
# If we're a striker, check apache's config.
if ($type eq "striker")
{
$anvil->Striker->check_httpd_conf({debug => 2});
}
# Now configure the network. # Now configure the network.
my $dns = defined $anvil->data->{variables}{form}{config_step2}{dns}{value} ? [split/,/, $anvil->data->{variables}{form}{config_step2}{dns}{value}] : []; my $dns = defined $anvil->data->{variables}{form}{config_step2}{dns}{value} ? [split/,/, $anvil->data->{variables}{form}{config_step2}{dns}{value}] : [];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { dns => $dns }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { dns => $dns }});

@ -943,12 +943,23 @@ AND
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { variable_uuid => $variable_uuid }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { variable_uuid => $variable_uuid }});
} }
# Make sure /etc/hosts is updated.
$anvil->System->update_hosts();
# Now look for jobs that have a job status of 'scancore_startup' # Now look for jobs that have a job status of 'scancore_startup'
run_jobs($anvil, 1); run_jobs($anvil, 1);
# Check the firewall needs to be updated. # Check the firewall needs to be updated.
check_firewall($anvil); check_firewall($anvil);
# If we're a striker, check apache
my $host_type = $anvil->Get->host_type;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { host_type => $host_type }});
if ($host_type eq "striker")
{
$anvil->Striker->check_httpd_conf({debug => 2});
}
return(0); return(0);
} }

Loading…
Cancel
Save