diff --git a/Anvil/Tools/Database.pm b/Anvil/Tools/Database.pm index 3d44ebb5..69263a7a 100644 --- a/Anvil/Tools/Database.pm +++ b/Anvil/Tools/Database.pm @@ -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"; diff --git a/Anvil/Tools/Network.pm b/Anvil/Tools/Network.pm index 98853fc9..9620ee97 100644 --- a/Anvil/Tools/Network.pm +++ b/Anvil/Tools/Network.pm @@ -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) { diff --git a/Anvil/Tools/ScanCore.pm b/Anvil/Tools/ScanCore.pm index 1fe867b4..c003f49c 100644 --- a/Anvil/Tools/ScanCore.pm +++ b/Anvil/Tools/ScanCore.pm @@ -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 }}); diff --git a/Anvil/Tools/Striker.pm b/Anvil/Tools/Striker.pm index 4795f80a..54d46a22 100644 --- a/Anvil/Tools/Striker.pm +++ b/Anvil/Tools/Striker.pm @@ -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) { diff --git a/Anvil/Tools/System.pm b/Anvil/Tools/System.pm index b35d1009..07ec0fb0 100644 --- a/Anvil/Tools/System.pm +++ b/Anvil/Tools/System.pm @@ -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) diff --git a/share/words.xml b/share/words.xml index 4eb5f956..bf3e9147 100644 --- a/share/words.xml +++ b/share/words.xml @@ -163,7 +163,7 @@ Failed to generate an RSA public key for the user: [#!variable!user!#]. The outp The file: [#!variable!file!#] wasn't found. The parameter get_company_from_oui->mac must be a valid MAC address or be in the format 'xx:xx:xx'. Received: [#!variable!mac!#]. The file: [#!variable!file!#] was not found. - find_matches() was given the hash key: [#!variable!key!#], but it does not reference a hash. Are any IPs associated with this target?]]> + 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!#].]]> Failed to reconnect after reconfiguring the network. Will reboot in hopes of coming up cleanly. The 'recipient_level': [#!variable!recipient_level!#] is invalid. It should be '0', '1', '2', or '3'. The 'notification_alert_level': [#!variable!notification_alert_level!#] is invalid. It should be '0', '1', '2', or '3'. @@ -2506,7 +2506,7 @@ Available options; Force a resync of the databases. I was asked to resync, but there is only one database available so no sense proceeding. - I was asked to resync. Disconnecting from databases and reconnecting with resync. + I was asked to resync. Calling the resync now. Aging out data to thin down the database(s). Prior to resync, we will check to see if any scan agent schemas need to be loaded. diff --git a/tools/anvil-manage-host b/tools/anvil-manage-host index f66c6496..ddc964db 100755 --- a/tools/anvil-manage-host +++ b/tools/anvil-manage-host @@ -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); } diff --git a/tools/anvil-provision-server b/tools/anvil-provision-server index 54c79d1e..275bc711 100755 --- a/tools/anvil-provision-server +++ b/tools/anvil-provision-server @@ -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}; diff --git a/tools/anvil-rename-server b/tools/anvil-rename-server index de253398..37238b8f 100755 --- a/tools/anvil-rename-server +++ b/tools/anvil-rename-server @@ -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; diff --git a/tools/striker-initialize-host b/tools/striker-initialize-host index 6c66a4f3..b7c982bc 100755 --- a/tools/striker-initialize-host +++ b/tools/striker-initialize-host @@ -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 => { diff --git a/tools/striker-manage-install-target b/tools/striker-manage-install-target index cbf97873..a6880169 100755 --- a/tools/striker-manage-install-target +++ b/tools/striker-manage-install-target @@ -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")