From 83d6cff4af9af8d0880d5411456bdc66e5a39668 Mon Sep 17 00:00:00 2001 From: Madison Kelly Date: Thu, 23 Jan 2020 21:45:27 -0500 Subject: [PATCH] * Fixed a bug with striker's initial configuration where 'update_value_only' was being set for the initial store of the config variables. * Added fonts to Striker's RPM list and to the anvil-striker RPM dependency list so that the terminal is actually useful. Signed-off-by: Madison Kelly --- Anvil/Tools/Database.pm | 17 ++++++++- cgi-bin/striker | 55 ++++++++++------------------- rpm/SPECS/anvil.spec | 5 +++ share/words.xml | 1 + tools/striker-manage-install-target | 6 +++- 5 files changed, 46 insertions(+), 38 deletions(-) diff --git a/Anvil/Tools/Database.pm b/Anvil/Tools/Database.pm index 12b5acaf..41d5e319 100644 --- a/Anvil/Tools/Database.pm +++ b/Anvil/Tools/Database.pm @@ -7700,7 +7700,7 @@ This is an optional database table name that the variables relates to. Generally =head3 update_value_only (optional, default '0') -When set to C<< 1 >>, this method will only update the variable's C<< variable_value >> column. Any other parameters are used to help locate the variable to update only. +When set to C<< 1 >>, this method will only update the variable's C<< variable_value >> column. Any other parameters are used to help locate the variable to update only. If the C<< variable_uuid >> isn't passed and can't be found, the call will fail and an empty string is returned. =cut sub insert_or_update_variables @@ -7807,6 +7807,21 @@ AND if ($update_value_only) { # Nothing to do. + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "warning_0030"}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { + uuid => $uuid, + file => $file, + line => $line, + variable_uuid => $variable_uuid, + variable_name => $variable_name, + variable_value => $variable_value, + variable_default => $variable_default, + variable_description => $variable_description, + variable_section => $variable_section, + variable_source_uuid => $variable_source_uuid, + variable_source_table => $variable_source_table, + update_value_only => $update_value_only, + }}); return(""); } diff --git a/cgi-bin/striker b/cgi-bin/striker index 7f0eefd2..4909aa5b 100755 --- a/cgi-bin/striker +++ b/cgi-bin/striker @@ -1971,7 +1971,6 @@ sub process_prep_network { # Clear the network map variable. $anvil->Database->insert_or_update_variables({ - debug => 2, variable_name => "config::map_network", variable_value => 0, variable_default => 0, @@ -1999,7 +1998,6 @@ sub process_prep_network else { $anvil->Database->insert_or_update_variables({ - debug => 3, variable_name => "form::config_step2::host_name::value", variable_value => $anvil->data->{cgi}{host_name}{value}, variable_default => "", @@ -2007,7 +2005,6 @@ sub process_prep_network variable_section => "config_step2", variable_source_uuid => $anvil->data->{cgi}{host_uuid}{value}, variable_source_table => "hosts", - update_value_only => 1, }); } } @@ -2034,7 +2031,6 @@ sub process_prep_network variable_section => "config_step2", variable_source_uuid => $anvil->data->{cgi}{host_uuid}{value}, variable_source_table => "hosts", - update_value_only => 1, }); } } @@ -2064,7 +2060,6 @@ sub process_prep_network variable_section => "config_step2", variable_source_uuid => $anvil->data->{cgi}{host_uuid}{value}, variable_source_table => "hosts", - update_value_only => 1, }); } } @@ -2083,7 +2078,6 @@ sub process_prep_network variable_section => "config_step1", variable_source_uuid => $anvil->data->{cgi}{host_uuid}{value}, variable_source_table => "hosts", - update_value_only => 1, }); foreach my $i (1..$loops) @@ -2180,7 +2174,6 @@ sub process_prep_network variable_section => "config_step2", variable_source_uuid => $anvil->data->{cgi}{host_uuid}{value}, variable_source_table => "hosts", - update_value_only => 1, }); $anvil->Database->insert_or_update_variables({ debug => 3, @@ -2191,7 +2184,6 @@ sub process_prep_network variable_section => "config_step2", variable_source_uuid => $anvil->data->{cgi}{host_uuid}{value}, variable_source_table => "hosts", - update_value_only => 1, }); } @@ -2235,7 +2227,6 @@ sub process_prep_network variable_section => "config_step2", variable_source_uuid => $anvil->data->{cgi}{host_uuid}{value}, variable_source_table => "hosts", - update_value_only => 1, }); } } @@ -2253,7 +2244,6 @@ sub process_prep_network variable_section => "config_step2", variable_source_uuid => $anvil->data->{cgi}{host_uuid}{value}, variable_source_table => "hosts", - update_value_only => 1, }); } @@ -2325,7 +2315,6 @@ sub process_prep_network variable_section => "config_step2", variable_source_uuid => $anvil->data->{cgi}{host_uuid}{value}, variable_source_table => "hosts", - update_value_only => 1, }); } if ($anvil->data->{cgi}{$link2_key}{value}) @@ -2339,7 +2328,6 @@ sub process_prep_network variable_section => "config_step2", variable_source_uuid => $anvil->data->{cgi}{host_uuid}{value}, variable_source_table => "hosts", - update_value_only => 1, }); } @@ -2353,7 +2341,6 @@ sub process_prep_network variable_section => "config_step2", variable_source_uuid => $anvil->data->{cgi}{host_uuid}{value}, variable_source_table => "hosts", - update_value_only => 1, }); $interfaces .= $anvil->Template->get({file => "anvil.html", name => "interface-entry", variables => { @@ -2436,7 +2423,7 @@ sub process_prep_network { # We're mapping $anvil->Database->insert_or_update_variables({ - debug => 2, + debug => 3, variable_name => "config::map_network", variable_value => 1, variable_default => 0, @@ -2657,7 +2644,7 @@ sub process_prep_host_page if ($host_uuid) { $anvil->Database->insert_or_update_variables({ - debug => 2, + debug => 3, variable_name => "system::configured", variable_source_uuid => $host_uuid, variable_source_table => "hosts", @@ -3919,11 +3906,11 @@ AND variable_source_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)." ORDER BY variable_name ASC;"; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0124", variables => { query => $query }}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0124", variables => { query => $query }}); my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__}); my $count = @{$results}; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { results => $results, count => $count, }}); @@ -3940,7 +3927,7 @@ ORDER BY { my $variable = $1; $anvil->data->{cgi}{$variable}{value} = $variable_value; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "cgi::${variable}::value" => $anvil->data->{cgi}{$variable}{value} }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::${variable}::value" => $anvil->data->{cgi}{$variable}{value} }}); } } } @@ -4299,7 +4286,6 @@ sub sanity_check_step2 variable_section => "config_step2", variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", - update_value_only => 1, }); } @@ -4322,7 +4308,6 @@ sub sanity_check_step2 variable_section => "config_step2", variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", - update_value_only => 1, }); } @@ -4345,7 +4330,6 @@ sub sanity_check_step2 variable_section => "config_step2", variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", - update_value_only => 1, }); } @@ -4379,7 +4363,6 @@ sub sanity_check_step2 variable_section => "config_step2", variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", - update_value_only => 1, }); } @@ -4439,7 +4422,6 @@ sub sanity_check_step2 variable_section => "config_step2", variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", - update_value_only => 1, }); } @@ -4469,7 +4451,6 @@ sub sanity_check_step2 variable_section => "config_step2", variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", - update_value_only => 1, }); } @@ -4500,7 +4481,6 @@ sub sanity_check_step2 variable_section => "config_step2", variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", - update_value_only => 1, }); } else @@ -4548,7 +4528,6 @@ sub sanity_check_step2 variable_section => "config_step2", variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", - update_value_only => 1, }); } else @@ -4631,7 +4610,6 @@ sub sanity_check_step2 variable_section => "config_step2", variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", - update_value_only => 1, }); # Record the gateway interface @@ -4643,7 +4621,6 @@ sub sanity_check_step2 variable_section => "config_step2", variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", - update_value_only => 1, }); } } @@ -4656,13 +4633,19 @@ sub sanity_check_step2 sub sanity_check_step1 { my ($anvil) = @_; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0131", variables => { function => "sanity_check_step1()" }}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0131", variables => { function => "sanity_check_step1()" }}); # This will flip if we run into a problem. my $sane = 1; + $anvil->data->{cgi}{organization}{value} = "" if not defined $anvil->data->{cgi}{organization}{value}; + # Organization just needs *something* - if ((not defined $anvil->data->{cgi}{organization}{value}) or (not $anvil->data->{cgi}{organization}{value})) + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + "cgi::organization::alert" => $anvil->data->{cgi}{organization}{alert}, + + }}); + if (not $anvil->data->{cgi}{organization}{value}) { $anvil->data->{form}{error_massage} = $anvil->Template->get({file => "main.html", name => "error_message", variables => { error_message => $anvil->Words->string({key => "error_0020", variables => { field => "striker_0003" }}) }}); $anvil->data->{cgi}{organization}{alert} = 1; @@ -4673,6 +4656,7 @@ sub sanity_check_step1 { # Record the answer. $anvil->Database->insert_or_update_variables({ + debug => 3, variable_name => "form::config_step1::organization::value", variable_value => $anvil->data->{cgi}{organization}{value}, variable_default => "", @@ -4680,7 +4664,6 @@ sub sanity_check_step1 variable_section => "config_step1", variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", - update_value_only => 1, }); } @@ -4696,6 +4679,7 @@ sub sanity_check_step1 { # Record the answer. $anvil->Database->insert_or_update_variables({ + debug => 3, variable_name => "form::config_step1::prefix::value", variable_value => $anvil->data->{cgi}{prefix}{value}, variable_default => "", @@ -4703,7 +4687,6 @@ sub sanity_check_step1 variable_section => "config_step1", variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", - update_value_only => 1, }); } @@ -4719,6 +4702,7 @@ sub sanity_check_step1 { # Record the answer. $anvil->Database->insert_or_update_variables({ + debug => 3, variable_name => "form::config_step1::domain::value", variable_value => $anvil->data->{cgi}{domain}{value}, variable_default => "", @@ -4726,7 +4710,6 @@ sub sanity_check_step1 variable_section => "config_step1", variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", - update_value_only => 1, }); } @@ -4742,6 +4725,7 @@ sub sanity_check_step1 { # Record the answer. $anvil->Database->insert_or_update_variables({ + debug => 3, variable_name => "form::config_step1::sequence::value", variable_value => $anvil->data->{cgi}{sequence}{value}, variable_default => "", @@ -4749,7 +4733,6 @@ sub sanity_check_step1 variable_section => "config_step1", variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", - update_value_only => 1, }); } @@ -4787,6 +4770,7 @@ sub sanity_check_step1 { # Sane, Record the answers. $anvil->Database->insert_or_update_variables({ + debug => 3, variable_name => "form::config_step1::ifn_count::value", variable_value => $anvil->data->{cgi}{ifn_count}{value}, variable_default => "", @@ -4794,11 +4778,10 @@ sub sanity_check_step1 variable_section => "config_step1", variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", - update_value_only => 1, }); } - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { sane => $sane }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { sane => $sane }}); return($sane); } diff --git a/rpm/SPECS/anvil.spec b/rpm/SPECS/anvil.spec index 2b7faf78..c31e00b3 100644 --- a/rpm/SPECS/anvil.spec +++ b/rpm/SPECS/anvil.spec @@ -82,7 +82,12 @@ Common base libraries required for the Anvil! system. Summary: Alteeve's Anvil! Striker dashboard package Requires: anvil-core Requires: anvil-striker-extra +Requires: bpg-dejavu-sans-fonts Requires: createrepo +Requires: dejavu-fonts-common +Requires: dejavu-sans-fonts +Requires: dejavu-sans-mono-fonts +Requires: dejavu-serif-fonts Requires: dhcp-server Requires: firefox Requires: gcc diff --git a/share/words.xml b/share/words.xml index bf50bf8b..cd83d6ff 100644 --- a/share/words.xml +++ b/share/words.xml @@ -1267,6 +1267,7 @@ Failure! The return code: [#!variable!return_code!#] was received ('0' was expec There was a problem saving the alert recipient data. Please check the logs for more information. Failed to read the fence agent: [#!variable!agent!#] metadata. Ignoring it. While resync'ing the table: [#!variable!table!#] on: [#!variable!host_name!# (#!variable!host_uuid!#)], there was an entry found in the public schema (#!variable!column!# = #!variable!uuid!#) but not in the history schema. This shouldn't happen, and it probably a bug. Switching the query's schema from public to history for the query: [#!variable!query!#] is being dropped. + Databse->insert_or_update_variables() was called with 'update_value_only' set, but the 'variable_uuid' wasn't passed or the 'variable_uuid' wasn't found given the 'variable_name'. Unable to update. Passed in values are logged below this message There are not enough network interfaces on this machine. You have: [#!variable!interface_count!#] interface(s), and you need at least: [#!variable!required_interfaces_for_single!#] interfaces to connect to the requested networks (one for Back-Channel and one for each Internet-Facing network). diff --git a/tools/striker-manage-install-target b/tools/striker-manage-install-target index 4956adb2..2f8ca238 100755 --- a/tools/striker-manage-install-target +++ b/tools/striker-manage-install-target @@ -1234,11 +1234,11 @@ sub load_packages "boost-regex.x86_64", "boost-system.x86_64", "boost-thread.x86_64", + "bpg-dejavu-sans-fonts.noarch", "brotli.x86_64", "bubblewrap.x86_64", "bzip2-libs.x86_64", "bzip2.x86_64", - ], c => [ "c-ares.x86_64", "ca-certificates.noarch", @@ -1296,6 +1296,10 @@ sub load_packages "dbus-x11.x86_64", "dbus.x86_64", "dconf.x86_64", + "dejavu-fonts-common.noarch", + "dejavu-sans-fonts.noarch", + "dejavu-sans-mono-fonts.noarch", + "dejavu-serif-fonts.noarch", "desktop-file-utils.x86_64", "device-mapper-event-libs.x86_64", "device-mapper-event.x86_64",