Updated anvil-daemon to run anvil-configure-host jobs when mapping net

Also fixed a bug in anvil-manage-host that prevented showing if the
network mapping flag was set.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 1 year ago
parent ff3d1983e3
commit 3251154366
  1. 9
      tools/anvil-daemon
  2. 2
      tools/anvil-manage-host

@ -1586,7 +1586,7 @@ sub keep_running
}
# Run any pending jobs by calling 'anvil-jobs' with the 'job_uuid' as a background process.
run_jobs($anvil, 0) if not $anvil->data->{sys}{mapping_network};
run_jobs($anvil, 0);
return(0);
}
@ -1622,13 +1622,14 @@ sub run_jobs
# If we're not configured, we won't hold on starting jobs
my $configured = $anvil->System->check_if_configured;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { configured => $configured }});
# We'll also update the jobs.json file.
my $jobs_file = "{\"jobs\":[\n";
# Get a list of pending or incomplete jobs.
my $ended_within = $startup ? 1 : 300;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { ended_within => $ended_within }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { ended_within => $ended_within }});
$anvil->Database->get_jobs({
debug => 2,
@ -1675,8 +1676,12 @@ sub run_jobs
's12:job_status' => $job_status,
's13:started_seconds_ago' => $started_seconds_ago,
's14:updated_seconds_ago' => $updated_seconds_ago,
's15:sys::mapping_network' => $anvil->data->{sys}{mapping_network},
}});
# If we're mapping, we'll only run 'anvil-configure-host' jobs on this host.
next if (($anvil->data->{sys}{mapping_network}) && ($job_command !~ /anvil-configure-host/));
# To minimize the chance of race conditions, any given command will be called only
# once at a time. If two jobs of the same command exist, only one will be called.
if ($job_progress != 100)

@ -247,7 +247,7 @@ sub update_network_mapping
's4:map_network_modified_date' => $map_network_modified_date,
's5:map_network_uuid' => $map_network_uuid,
}});
if ($anvil->data->{switches}{'check-configured'})
if ($anvil->data->{switches}{'check-network-mapping'})
{
# We'll run for a day (should be cancelled by the program when the user's done, so this
# shouldn't fire in practice).

Loading…
Cancel
Save