From ef3ac861628410acec611cd755ad60e63005ac15 Mon Sep 17 00:00:00 2001 From: Digimer Date: Tue, 9 Aug 2022 15:45:10 -0400 Subject: [PATCH] * Fixed a bug where setting the db_in_use flag without a valid $ENV{_}. * Added a nice_exit call to tools/striker-access-database Signed-off-by: Digimer --- Anvil/Tools/Database.pm | 2 +- scancore-agents/scan-lvm/scan-lvm | 1 + tools/anvil-daemon | 2 +- tools/anvil-manage-files | 19 +++++++++++++++++-- tools/striker-access-database | 1 + 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Anvil/Tools/Database.pm b/Anvil/Tools/Database.pm index bdb405f5..35b9a8a0 100644 --- a/Anvil/Tools/Database.pm +++ b/Anvil/Tools/Database.pm @@ -15379,7 +15379,7 @@ sub mark_active return(0); } - my $caller = $ENV{_}; + my $caller = $ENV{_} ? $ENV{_} : "unknown"; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { 'caller' => $caller }}); # Record that we're using each available striker DB UUID. diff --git a/scancore-agents/scan-lvm/scan-lvm b/scancore-agents/scan-lvm/scan-lvm index 872f63a0..9b41a252 100755 --- a/scancore-agents/scan-lvm/scan-lvm +++ b/scancore-agents/scan-lvm/scan-lvm @@ -86,6 +86,7 @@ find_changes($anvil); # Shut down. $anvil->ScanCore->agent_shutdown({agent => $THIS_FILE}); +$anvil->nice_exit({exit_code => 0}); ############################################################################################################# diff --git a/tools/anvil-daemon b/tools/anvil-daemon index 74ab578f..8312cbb8 100755 --- a/tools/anvil-daemon +++ b/tools/anvil-daemon @@ -841,7 +841,7 @@ sub check_incoming { my ($anvil) = @_; - my $shell_call = $anvil->data->{path}{exe}{'anvil-manage-files'}; + my $shell_call = $anvil->data->{path}{exe}{'anvil-manage-files'}." --check"; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }}); my ($output, $return_code) = $anvil->System->call({ shell_call => $shell_call, diff --git a/tools/anvil-manage-files b/tools/anvil-manage-files index 0e13beac..083153c8 100755 --- a/tools/anvil-manage-files +++ b/tools/anvil-manage-files @@ -51,7 +51,7 @@ if (($running_directory =~ /^\./) && ($ENV{PWD})) my $anvil = Anvil::Tools->new(); -$anvil->Get->switches({list => ["delete", "download", "file", "is-script", "job-uuid", "rename", "remove", "add", "to"], man => $THIS_FILE}); +$anvil->Get->switches({list => ["add", "check", "delete", "download", "file", "is-script", "job-uuid", "rename", "remove", "to"], man => $THIS_FILE}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => $anvil->data->{switches}}); # Connect or die @@ -106,7 +106,7 @@ elsif ($anvil->data->{switches}{'is-script'}) { handle_script($anvil); } -else +elsif ($anvil->data->{switches}{check}) { # Check for files scheduled for deletion. check_for_deletes($anvil); @@ -117,6 +117,11 @@ else # Check for files we should have but don't yet have. find_missing_files($anvil); } +else +{ + # Show the list of all files we know about. + show_files($anvil); +} # We're done $anvil->nice_exit({exit_code => 0}); @@ -126,6 +131,16 @@ $anvil->nice_exit({exit_code => 0}); # Private functions. # ############################################################################################################# +# This lists all files. +sub show_files +{ + my ($anvil) = @_; + + + + return(0); +} + # This looks to see if there are any entries in 'file_locations' for us that, the pointed to file, doesn't # exist on this machine. For those entries, we will search for the file on other machines. The one exception # is server definition files. For those, we write the file out from the server's 'definition' table entry. diff --git a/tools/striker-access-database b/tools/striker-access-database index 3aa82f9f..81768545 100755 --- a/tools/striker-access-database +++ b/tools/striker-access-database @@ -74,3 +74,4 @@ else $anvil->nice_exit({ exit_code => 1 }); } +$anvil->nice_exit({ exit_code => 0 });