Updated anvil-daemon to run anvil-configure-host in the foreground.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 7 months ago
parent f7082c930b
commit 8c1c0597da
  1. 1
      share/words.xml
  2. 26
      tools/anvil-daemon

@ -4202,6 +4202,7 @@ We will try to proceed anyway.</key>
<key name="warning_0175">[ Warning ] - The DB query: [#!variable!query!#] timed out! It was given: [#!variable!timeout!#] seconds, and alarmed with: [#!variable!error!#].</key> <key name="warning_0175">[ Warning ] - The DB query: [#!variable!query!#] timed out! It was given: [#!variable!timeout!#] seconds, and alarmed with: [#!variable!error!#].</key>
<key name="warning_0176">[ Warning ] - The DB query: [#!variable!query!#] failed with the error: [#!variable!error!#].</key> <key name="warning_0176">[ Warning ] - The DB query: [#!variable!query!#] failed with the error: [#!variable!error!#].</key>
<key name="warning_0177">[ Warning ] - SQL quoting string: [#!variable!string!#] failed with the error: [#!variable!error!#].</key> <key name="warning_0177">[ Warning ] - SQL quoting string: [#!variable!string!#] failed with the error: [#!variable!error!#].</key>
<key name="warning_0178">[ Warning ] - About to run 'anvil-configure-host'. This is likely going to take the network down, so we will hold here until this job is complete.</key>
</language> </language>
<!-- 日本語 --> <!-- 日本語 -->

@ -1911,7 +1911,30 @@ sub run_jobs
} }
} }
# Start the job, appending '--job-uuid' to the command. ### Start the job, appending '--job-uuid' to the command.
# If the job is 'anvil-configure-host', DO NOT background it! We need to call it and wait for it to return.
if ($job_command =~ /anvil-configure-host/)
{
# Log that we're going to run this and wait. Our DB connection is
# likely going to break, so disconnect now.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "warning_0178"});
$anvil->Database->disconnect();
my ($output, $return_code) = $anvil->System->call({
debug => 2,
shell_call => $command,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
output => $output,
return_code => $return_code,
}});
# Refresh and reconnect
$anvil->refresh({debug => 2});
$anvil->Database->connect({debug => 2, check_for_resync => 2});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0132"});
}
else
{
($anvil->data->{jobs}{handles}{$job_uuid}, my $return_code) = $anvil->System->call({ ($anvil->data->{jobs}{handles}{$job_uuid}, my $return_code) = $anvil->System->call({
background => 1, background => 1,
stdout_file => "/tmp/anvil.job.".$job_uuid.".stdout", stdout_file => "/tmp/anvil.job.".$job_uuid.".stdout",
@ -1939,6 +1962,7 @@ sub run_jobs
} }
} }
} }
}
# Close the jobs file. # Close the jobs file.
$jobs_file =~ s/,\n$/\n/ms; $jobs_file =~ s/,\n$/\n/ms;

Loading…
Cancel
Save