From 19c41c9171d8f780697278fbef94f49b5d6ebb2d Mon Sep 17 00:00:00 2001 From: Digimer Date: Tue, 8 Jun 2021 23:56:48 -0400 Subject: [PATCH] * Added more logging while chasing a function test bug. Signed-off-by: Digimer --- tools/anvil-daemon | 18 +++++++++--------- tools/anvil-manage-power | 3 ++- tools/anvil-update-system | 4 ++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tools/anvil-daemon b/tools/anvil-daemon index d3d3c876..c9d7e9b8 100755 --- a/tools/anvil-daemon +++ b/tools/anvil-daemon @@ -857,10 +857,10 @@ AND AND variable_name = 'reboot::needed' ;"; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0124", variables => { query => $query }}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0124", variables => { query => $query }}); my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__}); my $count = @{$results}; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { results => $results, count => $count, }}); @@ -869,7 +869,7 @@ AND $reboot_needed = $results->[0]->[0]; $changed_seconds_ago = $results->[0]->[1]; $changed_seconds_ago =~ s/^(\d+)\..*$/$1/; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { reboot_needed => $reboot_needed, changed_seconds_ago => $changed_seconds_ago, }}); @@ -879,7 +879,7 @@ AND # set. If the uptime is less, then the system rebooted since it was requested so clear it. h/t to # Lisa Seelye (@thedoh) for this idea! my $difference = ($changed_seconds_ago - $uptime); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "s1:reboot_needed" => $reboot_needed, "s2:changed_seconds_ago" => $changed_seconds_ago, "s3:uptime" => $uptime, @@ -890,18 +890,18 @@ AND if ($uptime < $changed_seconds_ago) { # Clear the reboot request. - $reboot_needed = $anvil->System->reboot_needed({set => 0}); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { reboot_needed => $reboot_needed }}); + $reboot_needed = $anvil->System->reboot_needed({debug => 2, set => 0}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { reboot_needed => $reboot_needed }}); # Check to see if there was a reboot job in progress. If so, finish it off. - my $job_uuid = $anvil->Job->get_job_uuid({program => "anvil-manage-power"}); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { job_uuid => $job_uuid }}); + my $job_uuid = $anvil->Job->get_job_uuid({debug => 2, program => "anvil-manage-power"}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { job_uuid => $job_uuid }}); if ($job_uuid) { # Update the percentage to '100' and then clear the old PID. my $date_time = $anvil->Get->date_and_time(); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { date_time => $date_time }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { date_time => $date_time }}); $anvil->Job->update_progress({ progress => 100, diff --git a/tools/anvil-manage-power b/tools/anvil-manage-power index 6029b689..4e53764a 100755 --- a/tools/anvil-manage-power +++ b/tools/anvil-manage-power @@ -245,10 +245,11 @@ sub do_poweroff # Make sure the 'reboot needed' flag is set. When 'anvil-daemon' starts, it will use this to confirm # that it is starting post-reboot and clear it. $reboot_needed = $anvil->System->reboot_needed({debug => 2, set => 1}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { reboot_needed => $reboot_needed }}); # Mark our power state. $anvil->Database->update_host_status({ - debug => $debug, + debug => 2, host_uuid => $anvil->Get->host_uuid, host_status => $task eq "poweroff" ? "rebooting" : "stopping";, }); diff --git a/tools/anvil-update-system b/tools/anvil-update-system index 78d6ffb0..0f8147ee 100755 --- a/tools/anvil-update-system +++ b/tools/anvil-update-system @@ -94,8 +94,8 @@ $anvil->System->maintenance_mode({set => 1}); run_os_update($anvil); # We're done updating -my $reboot_needed = $anvil->System->reboot_needed(); -$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { reboot_needed => $reboot_needed }}); +my $reboot_needed = $anvil->System->reboot_needed({debug => 2}); +$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { reboot_needed => $reboot_needed }}); if ($reboot_needed) { update_progress($anvil, 100, "message_0039");