diff --git a/Anvil/Tools/ScanCore.pm b/Anvil/Tools/ScanCore.pm index ea5b146f..968c5ba7 100644 --- a/Anvil/Tools/ScanCore.pm +++ b/Anvil/Tools/ScanCore.pm @@ -2488,7 +2488,12 @@ LIMIT 1;"; } } - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { check_power => $check_power }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { + check_power => $check_power, + short_host_name => $short_host_name, + host_ipmi => $host_ipmi, + host_status => $host_status, + }}); if (not $check_power) { next; @@ -2681,7 +2686,6 @@ LIMIT 1;"; $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0672", variables => { host_name => $host_name }}); # Check power - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0567", variables => { host_name => $host_name }}); my ($power_health, $shortest_time_on_batteries, $highest_charge_percentage, $estimated_hold_up_time) = $anvil->ScanCore->check_power({ debug => $debug, anvil_uuid => $anvil_uuid, diff --git a/Anvil/Tools/System.pm b/Anvil/Tools/System.pm index 1841a339..e128f57e 100644 --- a/Anvil/Tools/System.pm +++ b/Anvil/Tools/System.pm @@ -1458,6 +1458,12 @@ sub collect_ipmi_data return('!!error!!'); } + # Take the double-quotes off the password. + $ipmi_password =~ s/^"(.*)"$/$1/; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { + ipmi_password => $anvil->Log->is_secure($ipmi_password), + }}); + my $read_start_time = time; # If there is a password, write it to a temp file. diff --git a/share/anvil.sql b/share/anvil.sql index f832360d..22fa6904 100644 --- a/share/anvil.sql +++ b/share/anvil.sql @@ -408,6 +408,55 @@ CREATE TRIGGER trigger_anvils FOR EACH ROW EXECUTE PROCEDURE history_anvils(); +-- This is the new method of tracking DR hosts and while Anvil! node pairs they can back up. This allows DR +-- hosts to protect multiple nodes, and allow multiple DRs to protect one node pair. +CREATE TABLE dr_links ( + dr_link_uuid uuid not null primary key, + dr_link_host_uuid uuid not null, + dr_link_anvil_uuid uuid not null, + modified_date timestamp with time zone not null, + + FOREIGN KEY(dr_link_host_uuid) REFERENCES hosts(host_uuid), + FOREIGN KEY(dr_link_anvil_uuid) REFERENCES anvils(anvil_uuid) +); +ALTER TABLE dr_links OWNER TO admin; + +CREATE TABLE history.dr_links ( + history_id bigserial, + dr_link_uuid uuid, + dr_link_host_uuid uuid, + dr_link_anvil_uuid uuid, + modified_date timestamp with time zone not null +); +ALTER TABLE history.dr_links OWNER TO admin; + +CREATE FUNCTION history_dr_links() RETURNS trigger +AS $$ +DECLARE + history_dr_links RECORD; +BEGIN + SELECT INTO history_dr_links * FROM dr_links WHERE dr_link_uuid = new.dr_link_uuid; + INSERT INTO history.dr_links + (dr_link_uuid, + dr_link_host_uuid, + dr_link_anvil_uuid, + modified_date) + VALUES + (history_dr_links.dr_link_uuid, + history_dr_links.dr_link_host_uuid, + history_dr_links.dr_link_anvil_uuid, + history_dr_links.modified_date); + RETURN NULL; +END; +$$ +LANGUAGE plpgsql; +ALTER FUNCTION history_dr_links() OWNER TO admin; + +CREATE TRIGGER trigger_dr_links + AFTER INSERT OR UPDATE ON dr_links + FOR EACH ROW EXECUTE PROCEDURE history_dr_links(); + + -- This stores alerts coming in from various sources CREATE TABLE alerts ( alert_uuid uuid not null primary key,