diff --git a/Anvil/Tools.pm b/Anvil/Tools.pm
index 08cf5fcb..0830a213 100755
--- a/Anvil/Tools.pm
+++ b/Anvil/Tools.pm
@@ -610,6 +610,7 @@ sub _anvil_version
my $self = shift;
my $anvil = $self;
+ $anvil->data->{HOST}{ANVIL_VERSION} = "" if not defined $anvil->data->{HOST}{ANVIL_VERSION};
if ($anvil->data->{HOST}{ANVIL_VERSION} eq "")
{
# Try to read the local Anvil! version.
diff --git a/Anvil/Tools/Account.pm b/Anvil/Tools/Account.pm
index 27148dd1..b8f8cd7e 100755
--- a/Anvil/Tools/Account.pm
+++ b/Anvil/Tools/Account.pm
@@ -501,6 +501,7 @@ sub read_cookies
if ($count < 1)
{
# The user in the cookie isn't in the database. The user was deleted?
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0215"});
$anvil->Account->logout();
# Record the error message for the user.
@@ -560,6 +561,7 @@ sub read_cookies
#die;
# The user's cookie is invalid, log the user out.
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0215"});
$anvil->Account->logout();
# Record the error message for the user.
diff --git a/Anvil/Tools/Database.pm b/Anvil/Tools/Database.pm
index 89d37fb8..52f6d79a 100755
--- a/Anvil/Tools/Database.pm
+++ b/Anvil/Tools/Database.pm
@@ -5436,8 +5436,12 @@ sub _find_behind_databases
# 'modified_date' entries, or no entries in one DB with entries in the other (as can happen with a
# newly setup db).
$anvil->data->{sys}{database}{check_tables} = [];
+
+ # The 'hosts' table always has to be the first table sync'ed as just about everything else references it.
+ push @{$anvil->data->{sys}{database}{check_tables}}, "hosts";
foreach my $table (@{$anvil->data->{sys}{database}{core_tables}})
{
+ next if $table eq "hosts";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { table => $table }});
push @{$anvil->data->{sys}{database}{check_tables}}, $table;
}
@@ -5450,6 +5454,8 @@ sub _find_behind_databases
}
}
+
+
# Preset all tables to have an initial 'modified_date' of 0.
foreach my $table (sort {$a cmp $b} @{$anvil->data->{sys}{database}{check_tables}})
{
@@ -5571,7 +5577,7 @@ ORDER BY
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "log_0106", variables => { uuid => $uuid }});
# Mark it as behind.
- $anvil->Database->_mark_database_as_behind({uuid => $uuid});
+ $anvil->Database->_mark_database_as_behind({debug => $debug, uuid => $uuid});
last;
}
}
diff --git a/cgi-bin/striker b/cgi-bin/striker
index 4c2e27b2..c0204702 100755
--- a/cgi-bin/striker
+++ b/cgi-bin/striker
@@ -168,7 +168,13 @@ sub process_task
# Is the user trying to log in?
my $logged_in = 0;
- if ((defined $anvil->data->{cgi}{login}) && ($anvil->data->{cgi}{login}{value}))
+ $anvil->data->{cgi}{login}{value} = "" if not defined $anvil->data->{cgi}{login}{value};
+ $anvil->data->{cgi}{logout}{value} = "" if not defined $anvil->data->{cgi}{logout}{value};
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
+ "cgi::login::value" => $anvil->data->{cgi}{login}{value},
+ "cgi::logout::value" => $anvil->data->{cgi}{logout}{value},
+ }});
+ if ($anvil->data->{cgi}{login}{value})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::login::value" => $anvil->data->{cgi}{login}{value} }});
@@ -181,9 +187,10 @@ sub process_task
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { logged_in => $logged_in }});
}
}
- elsif ((defined $anvil->data->{cgi}{logout}) && ($anvil->data->{cgi}{logout}{value}))
+ elsif ($anvil->data->{cgi}{logout}{value})
{
# Bye now!
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0215"});
$anvil->Account->logout();
}
else
@@ -313,6 +320,7 @@ sub process_power
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "form::body" => $anvil->data->{form}{body} }});
# Log the user out, just to be safe.
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0215"});
$anvil->Account->logout();
}
else
diff --git a/notes b/notes
index a0219b18..560f63c6 100644
--- a/notes
+++ b/notes
@@ -1,3 +1,14 @@
+DB stuff;
+
+Dump;
+su - postgres -c "pg_dump anvil" > /anvil.out
+
+Reload the DB;
+su - postgres -c "dropdb anvil" && su - postgres -c "createdb --owner admin anvil" && su - postgres -c "psql anvil < /anvil.out"
+su - postgres -c "psql anvil"
+
+
+
All systems have a UUID, even VMs. Use that for system UUID in the future.
https://access.redhat.com/solutions/2841131 - How to write a NetworkManager dispatcher script to apply ethtool commands?
diff --git a/share/words.xml b/share/words.xml
index 5f553414..7428a0b1 100644
--- a/share/words.xml
+++ b/share/words.xml
@@ -363,6 +363,7 @@ The database connection error was:
We've been asked to have the new peer add us. We will now wait for the peer to show up in the 'hosts' table and then request the job for it to add us.
The peer: [#!variable!peer_uuid!#] is not yet in 'hosts', continuing to wait.
The peer: [#!variable!peer_name!#] is now in 'hosts', proceeding.
+ Logging the user: [#!data!sys::users::user_name!#] out.
Test
diff --git a/tools/anvil-configure-striker b/tools/anvil-configure-striker
index 4e901b61..3f9ea1c2 100755
--- a/tools/anvil-configure-striker
+++ b/tools/anvil-configure-striker
@@ -93,6 +93,7 @@ if (not $anvil->data->{switches}{'no-reboot'})
# Reboot, after waiting a few seconds to let the user's browser pick up the last messages in
# jobs.json. We'll also log the user out, in case we were re-configuring.
sleep 5;
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0215"});
$anvil->Account->logout;
$anvil->System->call({debug => 2, shell_call => $anvil->data->{path}{exe}{'anvil-manage-power'}." --reboot -y"});
}
diff --git a/tools/anvil-manage-striker-peers b/tools/anvil-manage-striker-peers
index 7f3c99fd..4ec62079 100755
--- a/tools/anvil-manage-striker-peers
+++ b/tools/anvil-manage-striker-peers
@@ -24,7 +24,6 @@
# /usr/sbin/anvil-manage-striker-peers --remove --host-uuid e20c3f10-c35d-4543-b5e6-8a373f27977a
#
-
use strict;
use warnings;
use Anvil::Tools;
@@ -569,10 +568,10 @@ sub process_entry
}
# Now add the job.
- my $host_uuid = $anvil->Get->host_uuid;
- my $sql_password = $anvil->data->{database}{$host_uuid}{password};
- my $job_command = $add_peer_command;
- my $job_data = "password=".$sql_password;
+ my $our_host_uuid = $anvil->Get->host_uuid;
+ my $sql_password = $anvil->data->{database}{$our_host_uuid}{password};
+ my $job_command = $add_peer_command;
+ my $job_data = "password=".$sql_password;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, list => { job_command => $job_command }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, secure => 1, list => { job_data => $job_data }});