Fixed a bug where non-strikers hung configuring their network.

* Updated Job->update_progress() to log and return if there are not DB
  connections.
* Bumped some logging in Database->connect().
* Deleted ifcfg code from anvil-configure-host.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 11 months ago
parent 827cf1f331
commit e03219d1d8
  1. 7
      Anvil/Tools/Database.pm
  2. 6
      Anvil/Tools/Job.pm
  3. 4
      share/words.xml
  4. 1046
      tools/anvil-configure-host

@ -1688,7 +1688,6 @@ sub connect
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $count = $anvil->Database->query({uuid => $uuid, query => $query, source => $THIS_FILE, line => __LINE__})->[0]->[0]; my $count = $anvil->Database->query({uuid => $uuid, query => $query, source => $THIS_FILE, line => __LINE__})->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { count => $count }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { count => $count }});
if ($count < 1) if ($count < 1)
{ {
@ -1778,6 +1777,9 @@ sub connect
# Record this as successful # Record this as successful
$anvil->data->{sys}{database}{connections}++; $anvil->data->{sys}{database}{connections}++;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"sys::database::connections" => $anvil->data->{sys}{database}{connections},
}});
push @{$successful_connections}, $uuid; push @{$successful_connections}, $uuid;
} }
@ -1838,6 +1840,9 @@ sub connect
$anvil->data->{sys}{database}{primary_db} = "" if $anvil->data->{sys}{database}{read_active} eq $uuid; $anvil->data->{sys}{database}{primary_db} = "" if $anvil->data->{sys}{database}{read_active} eq $uuid;
$anvil->data->{sys}{database}{read_uuid} = "" if $anvil->data->{sys}{database}{read_uuid} eq $uuid; $anvil->data->{sys}{database}{read_uuid} = "" if $anvil->data->{sys}{database}{read_uuid} eq $uuid;
$anvil->data->{sys}{database}{connections}--; $anvil->data->{sys}{database}{connections}--;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"sys::database::connections" => $anvil->data->{sys}{database}{connections},
}});
delete $anvil->data->{database}{$uuid}; delete $anvil->data->{database}{$uuid};
next; next;
} }

@ -745,6 +745,12 @@ sub update_progress
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { "sys::last_update" => $anvil->data->{sys}{last_update} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { "sys::last_update" => $anvil->data->{sys}{last_update} }});
} }
# If we don't have a database connection, we're done.
if (not $anvil->data->{sys}{database}{connections})
{
return(0);
}
# Add variables to the message, if required # Add variables to the message, if required
if (ref($variables) eq "HASH") if (ref($variables) eq "HASH")
{ {

@ -2708,6 +2708,7 @@ The file: [#!variable!file!#] needs to be updated. The difference is:
</key> </key>
<key name="log_0827">The physical volume: [#!variable!pv_name!#] has been resized!</key> <key name="log_0827">The physical volume: [#!variable!pv_name!#] has been resized!</key>
<key name="log_0828">The user answered: [#!variable!answer!#]</key> <key name="log_0828">The user answered: [#!variable!answer!#]</key>
<key name="log_0829">Failed to connect to any database, waiting before trying to connect again. We will reboot if we do not connect in: [#!variable!time_left!#] second.</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>
@ -3343,6 +3344,8 @@ proceeding.
<key name="message_0412">- The current DNS is: [#!variable!current_dns!#], will update.</key> <key name="message_0412">- The current DNS is: [#!variable!current_dns!#], will update.</key>
<key name="message_0413">- No update is needed.</key> <key name="message_0413">- No update is needed.</key>
<key name="message_0414">- The IP address needs to be assigned.</key> <key name="message_0414">- The IP address needs to be assigned.</key>
<key name="message_0415">[ Note ] - Reconfiguring the network will break connections. Disconnecting from the database before starting. It might take a bit before this system reconnects and progress can be seen.</key>
<key name="message_0416">[ Note ] - The network has reconnected to the database, configuring will complete shortly.</key>
<!-- Translate names (protocols, etc) --> <!-- Translate names (protocols, etc) -->
<key name="name_0001">Normal Password</key> <!-- none in mail-server --> <key name="name_0001">Normal Password</key> <!-- none in mail-server -->
@ -4153,6 +4156,7 @@ We will try to proceed anyway.</key>
==== ====
</key> </key>
<key name="warning_0168">Please specify a storage group to use to add the new drive to.</key> <key name="warning_0168">Please specify a storage group to use to add the new drive to.</key>
<key name="warning_0169">[ Warning ] - After reconfiguring the network, we've failed to connect to any database for two minutes. Rebooting in case this fixes the connection.</key>
</language> </language>
<!-- 日本語 --> <!-- 日本語 -->

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save