* Updated .spec for the new source location.

* Created a log disable flag to avoid deep recursion when logging at level 3.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent 05b1fccdb3
commit d9d347ce63
  1. 2
      Anvil/Tools.pm
  2. 8
      Anvil/Tools/Log.pm
  3. 1
      Anvil/Tools/Network.pm
  4. 2
      Anvil/Tools/Storage.pm
  5. 7
      rpm/SPECS/anvil.spec
  6. 15
      tools/anvil-daemon
  7. 2
      tools/striker-manage-install-target

@ -883,6 +883,8 @@ sub _set_defaults
# Stores the '-v|...|-vvv' so that shell calls can be run at the same level as the
# avtive program when set by the user at the command line.
level => "",
# This is set to '1' when a log call might become recursive.
disable => 0,
},
manage => {
firewall => 1,

@ -242,6 +242,9 @@ sub entry
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
my $test = defined $parameter->{test} ? $parameter->{test} : 0;
# If logging is disabled, return immediately.
return(0) if $anvil->data->{sys}{'log'}{disable};
# If we're called before $anvil->_set_defaults, this will be undefined.
$anvil->data->{defaults}{'log'}{level} = 1 if not defined $anvil->data->{defaults}{'log'}{level};
@ -458,7 +461,9 @@ sub entry
### WARNING: We MUST set the debug level really high, or else we'll go into a deep
### recursion!
# Make sure the log directory exists.
$anvil->data->{sys}{'log'}{disable} = 1;
$anvil->Storage->make_directory({test => $test, debug => 99, directory => $directory, mode => 755});
$anvil->data->{sys}{'log'}{disable} = 0;
# Now open the log
my $shell_call = $log_file;
@ -780,6 +785,9 @@ sub variables
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
my $test = defined $parameter->{test} ? $parameter->{test} : 0;
# Return immediately if logging is disabled globally.
return(0) if $anvil->data->{sys}{'log'}{disable};
my $language = defined $parameter->{language} ? $parameter->{language} : $anvil->data->{defaults}{'log'}{language};
my $level = defined $parameter->{level} ? $parameter->{level} : 2;
my $line = defined $parameter->{line} ? $parameter->{line} : "";

@ -2014,7 +2014,6 @@ sub is_local
my $parameter = shift;
my $anvil = $self->parent;
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Network->is_local()" }});
my $host = $parameter->{host} ? $parameter->{host} : "";
return(1) if not $host;

@ -1663,7 +1663,7 @@ sub make_directory
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { working_directory => $working_directory }});
# Are we working locally or remotely?
if ($anvil->Network->is_local({host => $target}))
if ($anvil->Network->is_local({debug => $debug, host => $target}))
{
# Locally.
if (not -e $working_directory)

@ -7,8 +7,8 @@ Release: 37%{?dist}
Summary: Alteeve Anvil! complete package.
License: GPLv2+
URL: https://github.com/digimer/anvil
Source0: https://www.alteeve.com/an-repo/el8b/files/anvil-3.0b.tar.gz
URL: https://github.com/ClusterLabs/anvil
Source0: https://www.alteeve.com/an-repo/el8/SOURCES/anvil-3.0b.tar.gz
BuildArch: noarch
@ -382,8 +382,9 @@ fi
%changelog
* tbd Madison Kelly <mkelly@alteeve.ca> 3.0-37
* Mon Jan 18 2021 Madison Kelly <mkelly@alteeve.ca> 3.0-37
- Updated source.
- Moved repos to ClusterLabs group and updated Source.
* Tue Nov 17 2020 Madison Kelly <mkelly@alteeve.ca> 3.0-36
- Updated source.

@ -73,9 +73,6 @@ $( = $);
# NOTE: Setting 'log_level' and 'log_secure' here will get overridden in the main lopp. Use the Log methods
# in the loop as well to override defaults in code.
my $anvil = Anvil::Tools->new();
$anvil->Log->level({set => 2});
$anvil->Log->secure({set => 1});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0115", variables => { program => $THIS_FILE }});
# Make sure we're running as 'root'
# $< == real UID, $> == effective UID
@ -88,8 +85,8 @@ if (($< != 0) && ($> != 0))
# Connect to the database(s). If we have no connections, we'll proceed anyway as one of the 'run_once' tasks
# is to setup the database server.
$anvil->Database->connect({debug => 3, check_if_configured => 1});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0132"});
$anvil->Database->connect({check_if_configured => 1});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0132"});
# If I have no databases, sleep for a second and then exit (systemd will restart us).
if (not $anvil->data->{sys}{database}{connections})
@ -140,6 +137,8 @@ $anvil->data->{switches}{'no-start'} = 0;
$anvil->data->{switches}{'startup-only'} = 0;
$anvil->Get->switches;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0115", variables => { program => $THIS_FILE }});
if ($anvil->data->{switches}{'refresh-json'})
{
$anvil->data->{switches}{'run-once'} = 1;
@ -464,7 +463,7 @@ sub handle_periodic_tasks
job_description => "job_0017",
job_progress => 0,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { job_uuid => $job_uuid }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { job_uuid => $job_uuid }});
# Update the OUI data.
($job_uuid) = $anvil->Database->insert_or_update_jobs({
@ -477,7 +476,7 @@ sub handle_periodic_tasks
job_description => "job_0065",
job_progress => 0,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { job_uuid => $job_uuid }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { job_uuid => $job_uuid }});
# Scan the networks
($job_uuid) = $anvil->Database->insert_or_update_jobs({
@ -490,7 +489,7 @@ sub handle_periodic_tasks
job_description => "job_0067",
job_progress => 0,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { job_uuid => $job_uuid }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { job_uuid => $job_uuid }});
}
# Update the next check time.

@ -2680,9 +2680,9 @@ sub load_packages
"yajl.x86_64",
"yum.noarch",
"yum-utils.noarch",
"zenity.x86_64",
],
z => [
"zenity.x86_64",
"zlib.x86_64",
"zlib-devel.x86_64",
"zstd.x86_64",

Loading…
Cancel
Save