Added default logging level 2 and secure logging in CI tests.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 10 months ago
parent f40d25f2dd
commit 741bcfa908
  1. 1
      Anvil/Tools.pm
  2. 23
      Anvil/Tools/Get.pm
  3. 1
      share/words.xml
  4. 22
      tools/anvil-configure-host
  5. 2
      tools/anvil-daemon
  6. 4
      tools/anvil-delete-server
  7. 5
      tools/anvil-safe-start
  8. 4
      tools/anvil-sync-shared
  9. 35
      tools/striker-auto-initialize-all
  10. 4
      tools/striker-collect-debug

@ -1056,6 +1056,7 @@ sub _set_paths
configs => {
'alteeve-release.repo' => "/etc/yum.repos.d/alteeve-release.repo",
'anvil.conf' => "/etc/anvil/anvil.conf",
'anvil.debug' => "/etc/anvil/anvil.debug",
'anvil.version' => "/etc/anvil/anvil.version",
'autoindex.conf' => "/etc/httpd/conf.d/autoindex.conf",
'cib.xml' => "/var/lib/pacemaker/cib/cib.xml",

@ -2895,6 +2895,29 @@ sub switches
$anvil->nice_exit({exit_code => 0});
}
# Lastly, if there's a anvil.debug file, set logging to '-vv --log-secure'
if (-e $anvil->data->{path}{configs}{'anvil.debug'})
{
$anvil->data->{switches}{v} = "";
$anvil->data->{switches}{v} = "";
$anvil->data->{switches}{vv} = "#!SET!#";
$anvil->data->{switches}{'log-secure'} = "#!SET!#";
$anvil->data->{defaults}{'log'}{pids} = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"switches::V" => $anvil->data->{switches}{V},
"switches::v" => $anvil->data->{switches}{v},
"switches::vv" => $anvil->data->{switches}{vv},
"switches::log-secure" => $anvil->data->{switches}{'log-secure'},
"defaults::log::pids" => $anvil->data->{defaults}{'log'}{pids},
}});
### TODO: We might want to set this?
#$anvil->data->{sys}{database}{log_transactions} = 1;
# Adjust the log level if requested.
$anvil->Log->_adjust_log_level();
}
return(0);
}

@ -2723,6 +2723,7 @@ The file: [#!variable!file!#] needs to be updated. The difference is:
<key name="log_0840">CPU percent time doing; (IO wait / user / system / nice'd / idle / involuntary wait): [#!variable!iowait!# / #!variable!user!# / #!variable!system!# / #!variable!nice!# / #!variable!idle!#/ #!variable!steal!#].</key>
<key name="log_0841">Processes; (total / running / blocked / IRQ interrupts): [#!variable!total!# / #!variable!running!# / #!variable!blocked!# / #!variable!interrupts!#].</key>
<key name="log_0842">Starting the network manager connection: [#!variable!id!#] (uuid: [#!variable!uuid!#]).</key>
<key name="log_0843">Creating the [#!variable!file!#] debug file on: [#!variable!host!#].</key>
<!-- Messages for users (less technical than log entries), though sometimes used for logs, too. -->
<key name="message_0001">The host name: [#!variable!target!#] does not resolve to an IP address.</key>

@ -37,11 +37,27 @@ $| = 1;
my $anvil = Anvil::Tools->new();
# Read switches
$anvil->Get->switches({list => ["job-uuid"], man => $THIS_FILE});
$anvil->Get->switches({list => [
"job-uuid",
"debug",
], man => $THIS_FILE});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => $anvil->data->{switches}});
$anvil->Log->level({set => 2});
$anvil->Log->secure({set => 1});
if (($anvil->data->{switches}{debug}) && (not -e $anvil->data->{path}{configs}{'anvil.debug'}))
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, key => "log_0843", variables => {
file => $anvil->data->{path}{configs}{'anvil.debug'},
host => $anvil->Get->short_host_name(),
}});
my $problem = $anvil->Storage->write_file({
file => $anvil->data->{path}{configs}{'anvil.debug'},
body => "",
overwrite => 1,
user => "root",
group => "root",
mode => "0666",
});
}
# Make sure we're running as 'root'
# $< == real UID, $> == effective UID

@ -54,8 +54,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});
# Make sure we're running as 'root'
# $< == real UID, $> == effective UID

@ -36,10 +36,6 @@ $anvil->Get->switches({list => [
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => $anvil->data->{switches}});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, secure => 0, key => "log_0115", variables => { program => $THIS_FILE }});
### TODO: Remove this post testing
$anvil->Log->level({set => 2});
$anvil->Log->secure({set => 1});
$anvil->Database->connect();
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 3, secure => 0, key => "log_0132"});
if (not $anvil->data->{sys}{database}{connections})

@ -44,11 +44,6 @@ $anvil->Get->switches({list => [], man => $THIS_FILE});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => $anvil->data->{switches}});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0115", variables => { program => $THIS_FILE }});
### TODO: Remove before PR!
# Force up the logging.
$anvil->Log->level({set => 2});
$anvil->Log->secure({set => 1});
# Make sure we're running as 'root'
# $< == real UID, $> == effective UID
if (($< != 0) && ($> != 0))

@ -35,10 +35,6 @@ my $anvil = Anvil::Tools->new();
$anvil->data->{switches}{'job-uuid'} = "";
$anvil->Get->switches;
### TODO: Remove this
$anvil->Log->level({set => 2});
$anvil->Log->secure({set => 1});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0115", variables => { program => $THIS_FILE }});
# Connect to the database(s).

@ -21,9 +21,33 @@ if (($running_directory =~ /^\./) && ($ENV{PWD}))
$running_directory =~ s/^\./$ENV{PWD}/;
}
my $anvil = Anvil::Tools->new();
# Before we read switches, set the debug file.
if (not -e $anvil->data->{path}{configs}{'anvil.debug'})
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, key => "log_0843", variables => {
file => $anvil->data->{path}{configs}{'anvil.debug'},
host => $anvil->Get->short_host_name(),
}});
my $problem = $anvil->Storage->write_file({
file => $anvil->data->{path}{configs}{'anvil.debug'},
body => "",
overwrite => 1,
user => "root",
group => "root",
mode => "0666",
});
}
# Read switches
$anvil->Get->switches({list => [
"config",
"job-uuid",
], man => $THIS_FILE});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => $anvil->data->{switches}});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0115", variables => { program => $THIS_FILE }});
$anvil->Database->connect;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0132"});
if (not $anvil->data->{sys}{database}{connections})
@ -32,9 +56,6 @@ if (not $anvil->data->{sys}{database}{connections})
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, 'print' => 1, priority => "err", key => "error_0003"});
$anvil->nice_exit({exit_code => 1});
}
$anvil->data->{switches}{config} = "";
$anvil->data->{switches}{'job-uuid'} = "";
$anvil->Get->switches;
# Read in the config file
if ((not $anvil->data->{switches}{config}) or (not -f $anvil->data->{switches}{config}))
@ -324,7 +345,7 @@ sub configure_machine_networks
my ($job_uuid) = $anvil->Database->insert_or_update_jobs({
debug => 2,
job_host_uuid => $machine_host_uuid,
job_command => $anvil->data->{path}{exe}{'anvil-configure-host'}.$anvil->Log->switches,
job_command => $anvil->data->{path}{exe}{'anvil-configure-host'}." --debug ".$anvil->Log->switches,
job_data => "form::config_step2",
job_name => "configure::network",
job_title => "job_0001",
@ -1683,7 +1704,7 @@ sub striker_stage1
my ($job_uuid) = $anvil->Database->insert_or_update_jobs({
debug => 2,
job_host_uuid => $anvil->data->{cgi}{host_uuid}{value},
job_command => $anvil->data->{path}{exe}{'anvil-configure-host'}.$anvil->Log->switches,
job_command => $anvil->data->{path}{exe}{'anvil-configure-host'}." --debug ".$anvil->Log->switches,
job_data => "form::config_step2",
job_name => "configure::network",
job_title => "job_0001",
@ -1698,7 +1719,7 @@ sub striker_stage1
my ($job_uuid) = $anvil->Database->insert_or_update_jobs({
debug => 2,
job_host_uuid => $anvil->data->{cgi}{host_uuid}{value},
job_command => $anvil->data->{path}{exe}{'striker-auto-initialize-all'}." --config ".$anvil->data->{switches}{config}.$anvil->Log->switches,
job_command => $anvil->data->{path}{exe}{'striker-auto-initialize-all'}." --debug --config ".$anvil->data->{switches}{config}.$anvil->Log->switches,
job_data => "",
job_name => "configure::auto_initialize",
job_title => "job_0225",

@ -40,10 +40,6 @@ $anvil->Get->switches({list => [
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => $anvil->data->{switches}});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0115", variables => { program => $THIS_FILE }});
### TODO: Disable this before merging into PR
$anvil->Log->level({set => 2});
$anvil->Log->secure({set => 1});
# 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();

Loading…
Cancel
Save