* Fixed a typo causing anvil-manage-power to not compile.

* Updated anvil-configure-host to register a reboot job when needed.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent b6f60f1bb1
commit 04f7571097
  1. 13
      tools/anvil-configure-host
  2. 2
      tools/anvil-manage-power
  3. 5
      tools/anvil-update-states

@ -112,6 +112,19 @@ sub do_reboot
{ {
my ($anvil) = @_; my ($anvil) = @_;
# Mark that a reboot is needed, in case something kills us before we actually reboot.
my ($job_uuid) = $anvil->Database->insert_or_update_jobs({
file => $THIS_FILE,
line => __LINE__,
job_command => $anvil->data->{path}{exe}{'anvil-manage-power'}." --reboot -y".$anvil->Log->switches,
job_data => "",
job_name => "reboot::system",
job_title => "job_0009",
job_description => "job_0006",
job_progress => 0,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { job_uuid => $job_uuid }});
my $time_left = 60; my $time_left = 60;
while ($time_left) while ($time_left)
{ {

@ -251,7 +251,7 @@ sub do_poweroff
$anvil->Database->update_host_status({ $anvil->Database->update_host_status({
debug => 2, debug => 2,
host_uuid => $anvil->Get->host_uuid, host_uuid => $anvil->Get->host_uuid,
host_status => $task eq "poweroff" ? "rebooting" : "stopping";, host_status => $task eq "poweroff" ? "rebooting" : "stopping",
}); });
# Now do the deed. # Now do the deed.

@ -2,6 +2,9 @@
# #
# This updates things like the current network configuration, shared file data and writes it out to a json file. # This updates things like the current network configuration, shared file data and writes it out to a json file.
# #
# TODO:
# - Retire this once scan-network is finished.
#
use strict; use strict;
use warnings; use warnings;
use Anvil::Tools; use Anvil::Tools;
@ -25,7 +28,7 @@ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure =
# If there's no DB (or cached data isn't recorded to the database yet), this will store those records. # If there's no DB (or cached data isn't recorded to the database yet), this will store those records.
$anvil->data->{cache}{new_file} = "# interface,timestamp,mac_address,speed,link_state,operational\n"; $anvil->data->{cache}{new_file} = "# interface,timestamp,mac_address,speed,link_state,operational\n";
$anvil->Database->connect({debug => 3}); $anvil->Database->connect();
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0132"}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0132"});
if (not $anvil->data->{sys}{database}{connections}) if (not $anvil->data->{sys}{database}{connections})
{ {

Loading…
Cancel
Save