* Fixed a bug where resync'ing the database was missing tables.

* Updated Network->find_matches() to take 'source' and 'line' parameters to help identify the source of issues with missing hashes.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 3 years ago
parent 74b7719cf5
commit aa7d9bdf14
  1. 8
      Anvil/Tools/Database.pm
  2. 18
      Anvil/Tools/Network.pm
  3. 2
      Anvil/Tools/ScanCore.pm
  4. 2
      Anvil/Tools/Striker.pm
  5. 2
      Anvil/Tools/System.pm
  6. 4
      share/words.xml
  7. 8
      tools/anvil-manage-host
  8. 2
      tools/anvil-provision-server
  9. 2
      tools/anvil-rename-server
  10. 4
      tools/striker-initialize-host
  11. 2
      tools/striker-manage-install-target

@ -15930,12 +15930,10 @@ sub resync_databases
# Before resync, age out the data in each DB
$anvil->Database->_age_out_data({debug => $debug});
### NOTE: Don't sort this array, we need to resync in the order that the user passed the tables to us
### to avoid trouble with primary/foreign keys.
# We're going to use the array of tables assembles by _find_behind_databases() stored in
# 'sys::database::check_tables'
# Build a list of tables
my $tables = $anvil->Database->get_tables_from_schema({debug => $debug, schema_file => "all"});
my $start_time = time;
foreach my $table (@{$anvil->data->{sys}{database}{check_tables}})
foreach my $table (@{$tables})
{
# We don't sync 'states' as it's transient and sometimes per-DB.
next if $table eq "states";

@ -1060,9 +1060,13 @@ sub find_matches
my $first = defined $parameter->{first} ? $parameter->{first} : "";
my $second = defined $parameter->{second} ? $parameter->{second} : "";
my $source = defined $parameter->{source} ? $parameter->{source} : $THIS_FILE;
my $line = defined $parameter->{line} ? $parameter->{line} : __LINE__;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
first => $first,
second => $second,
source => $source,
line => $line,
}});
if (not $first)
@ -1072,7 +1076,11 @@ sub find_matches
}
elsif (ref($anvil->data->{network}{$first}) ne "HASH")
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "error_0106", variables => { key => "first -> network::".$first }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "error_0106", variables => {
key => "first -> network::".$first,
source => $source,
line => $line,
}});
return("");
}
if (not $second)
@ -1082,7 +1090,11 @@ sub find_matches
}
elsif (ref($anvil->data->{network}{$second}) ne "HASH")
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "error_0106", variables => { key => "second -> network::".$second }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "error_0106", variables => {
key => "second -> network::".$second,
source => $source,
line => $line,
}});
return("");
}
@ -1221,6 +1233,8 @@ sub find_target_ip
debug => $debug,
first => $short_host_name,
second => $target_host_name,
source => $THIS_FILE,
line => __LINE__,
});
if ($match)
{

@ -2404,6 +2404,8 @@ LIMIT 1;";
debug => $debug,
first => $anvil->Get->host_uuid,
second => $host_uuid,
source => $THIS_FILE,
line => __LINE__,
});
my $matched_ips = keys %{$match};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { matched_ips => $matched_ips }});

@ -1398,6 +1398,8 @@ sub parse_all_status_json
debug => 3,
first => $anvil->Get->short_host_name(),
second => $short_name,
source => $THIS_FILE,
line => __LINE__,
});
if ($match)
{

@ -2668,6 +2668,8 @@ sub generate_state_json
debug => $debug,
first => $anvil->Get->short_host_name(),
second => $short_host_name,
source => $THIS_FILE,
line => __LINE__,
});
if ($match)

@ -163,7 +163,7 @@ Failed to generate an RSA public key for the user: [#!variable!user!#]. The outp
<key name="error_0103">The file: [#!variable!file!#] wasn't found.</key>
<key name="error_0104">The parameter get_company_from_oui->mac must be a valid MAC address or be in the format 'xx:xx:xx'. Received: [#!variable!mac!#].</key>
<key name="error_0105">The file: [#!variable!file!#] was not found.</key>
<key name="error_0106"><![CDATA[The method Network->find_matches() was given the hash key: [#!variable!key!#], but it does not reference a hash. Are any IPs associated with this target?]]></key>
<key name="error_0106"><![CDATA[The method Network->find_matches() was given the hash key: [#!variable!key!#], but it does not reference a hash. Are any IPs associated with this target? The caller was: [#!variable!source!#:#!variable!line!#].]]></key>
<key name="error_0107">Failed to reconnect after reconfiguring the network. Will reboot in hopes of coming up cleanly.</key>
<key name="error_0108">The 'recipient_level': [#!variable!recipient_level!#] is invalid. It should be '0', '1', '2', or '3'.</key>
<key name="error_0109">The 'notification_alert_level': [#!variable!notification_alert_level!#] is invalid. It should be '0', '1', '2', or '3'.</key>
@ -2506,7 +2506,7 @@ Available options;
Force a resync of the databases.
</key>
<key name="message_0283">I was asked to resync, but there is only one database available so no sense proceeding.</key>
<key name="message_0284">I was asked to resync. Disconnecting from databases and reconnecting with resync.</key>
<key name="message_0284">I was asked to resync. Calling the resync now.</key>
<key name="message_0285">Aging out data to thin down the database(s).</key>
<key name="message_0286">Prior to resync, we will check to see if any scan agent schemas need to be loaded.</key>

@ -138,12 +138,8 @@ sub resync_database
# Disconnect and reconnect.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "message_0284"});
$anvil->Database->disconnect();
$anvil->refresh();
$anvil->Database->connect({
all => 1,
check_for_resync => 1,
});
$anvil->data->{sys}{database}{resync_needed} = 1;
$anvil->Database->resync_databases({debug => 2});
return(0);
}

@ -953,6 +953,8 @@ sub get_sn_details
my $match = $anvil->Network->find_matches({
first => $anvil->data->{job}{node1_short_host_name},
second => $anvil->data->{job}{node2_short_host_name},
source => $THIS_FILE,
line => __LINE__,
});
my $node1_short_host_name = $anvil->data->{job}{node1_short_host_name};

@ -970,6 +970,8 @@ sub gather_server_data
debug => 2,
first => $local_drbd_node_name,
second => $host_name,
source => $THIS_FILE,
line => __LINE__,
});
my $access = 0;

@ -181,6 +181,8 @@ sub add_databases
debug => 3,
first => $local_host,
second => $target,
source => $THIS_FILE,
line => __LINE__,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { match => $match }});
@ -290,6 +292,8 @@ sub add_databases
my ($match) = $anvil->Network->find_matches({
first => $target,
second => $uuid,
source => $THIS_FILE,
line => __LINE__,
});
my $keys = keys %{$match};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {

@ -1241,6 +1241,8 @@ ORDER BY
debug => 2,
first => $local_short_host_name,
second => $short_host_name,
source => $THIS_FILE,
line => __LINE__,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { match => $match }});
if (ref($match) eq "HASH")

Loading…
Cancel
Save