From 4cf9d6215c15793099687ba919808d5e7af81f1f Mon Sep 17 00:00:00 2001 From: Digimer Date: Mon, 6 Jan 2020 19:47:37 -0500 Subject: [PATCH] * Removed the table host_mail_servers. * Added a check in striker-manage-install-target to watch for and remove bad RPMs. Signed-off-by: Digimer --- Anvil/Tools.pm | 3 +- Anvil/Tools/Database.pm | 6 ++-- rpm/SPECS/anvil.spec | 4 +-- share/anvil.sql | 54 ----------------------------- share/words.xml | 1 + tools/striker-manage-install-target | 26 ++++++++++++-- tools/test.pl | 3 +- 7 files changed, 33 insertions(+), 64 deletions(-) diff --git a/Anvil/Tools.pm b/Anvil/Tools.pm index 5c37da87..e5bf359b 100644 --- a/Anvil/Tools.pm +++ b/Anvil/Tools.pm @@ -891,7 +891,6 @@ sub _set_defaults "recipients", "notifications", "mail_servers", - "host_mail_servers", "variables", "jobs", "network_interfaces", @@ -1128,7 +1127,7 @@ sub _set_paths cibadmin => "/usr/sbin/cibadmin", cp => "/usr/bin/cp", createdb => "/usr/bin/createdb", - createrepo => "/usr/bin/createrepo", + createrepo_c => "/usr/bin/createrepo_c", createuser => "/usr/bin/createuser", crm_error => "/usr/sbin/crm_error", dmidecode => "/usr/sbin/dmidecode", diff --git a/Anvil/Tools/Database.pm b/Anvil/Tools/Database.pm index 8af881a5..e210e5cb 100644 --- a/Anvil/Tools/Database.pm +++ b/Anvil/Tools/Database.pm @@ -2197,9 +2197,9 @@ FROM $anvil->data->{notifications}{notification_uuid}{$notification_uuid}{notification_host_uuid} = $notification_host_uuid; $anvil->data->{notifications}{notification_uuid}{$notification_uuid}{notification_alert_level} = $notification_alert_level; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { - "notifications::notification_uuid::${notification_uuid}}::notification_recipient_uuid" => $anvil->data->{notifications}{mail_server}{$mail_server_uuid}{notification_recipient_uuid}, - "notifications::notification_uuid::${notification_uuid}}::notification_host_uuid" => $anvil->data->{notifications}{mail_server}{$mail_server_uuid}{notification_host_uuid}, - "notifications::notification_uuid::${notification_uuid}}::notification_alert_level" => $anvil->data->{notifications}{mail_server}{$mail_server_uuid}{notification_alert_level}, + "notifications::notification_uuid::${notification_uuid}::notification_recipient_uuid" => $anvil->data->{notifications}{notification_uuid}{$notification_uuid}{notification_recipient_uuid}, + "notifications::notification_uuid::${notification_uuid}::notification_host_uuid" => $anvil->data->{notifications}{notification_uuid}{$notification_uuid}{notification_host_uuid}, + "notifications::notification_uuid::${notification_uuid}::notification_alert_level" => $anvil->data->{notifications}{notification_uuid}{$notification_uuid}{notification_alert_level}, }}); } diff --git a/rpm/SPECS/anvil.spec b/rpm/SPECS/anvil.spec index 05dbdfc3..45f5e40a 100644 --- a/rpm/SPECS/anvil.spec +++ b/rpm/SPECS/anvil.spec @@ -354,9 +354,9 @@ fi %changelog -* tbd Madison Kelly 3.0-31 +* Mon Jan 6 2020 Madison Kelly 3.0-31 - Added perl-Mail-RFC822-Address to core requirements. -- +- Updated source. * Fri Dec 13 2019 Madison Kelly 3.0-30 - Enabled/started chronyd in core's post. diff --git a/share/anvil.sql b/share/anvil.sql index 0c1faa83..a5fe0186 100644 --- a/share/anvil.sql +++ b/share/anvil.sql @@ -617,60 +617,6 @@ CREATE TRIGGER trigger_mail_servers FOR EACH ROW EXECUTE PROCEDURE history_mail_servers(); --- NOTE: If multiple entries for the same host have the same order, the host name will be used to sort for --- priority purposes. --- This creates links between hosts and mail servers to use for alerts. -CREATE TABLE host_mail_servers ( - host_mail_server_uuid uuid not null primary key, - host_mail_server_host_uuid uuid not null, -- The host we're configuring - host_mail_server_mail_server_uuid uuid not null, -- The mail server to use - host_mail_server_order integer not null, -- The priority of this mail server. - modified_date timestamp with time zone not null, - - FOREIGN KEY(host_mail_server_host_uuid) REFERENCES hosts(host_uuid), - FOREIGN KEY(host_mail_server_mail_server_uuid) REFERENCES mail_servers(mail_server_uuid) -); -ALTER TABLE host_mail_servers OWNER TO admin; - -CREATE TABLE history.host_mail_servers ( - history_id bigserial, - host_mail_server_uuid uuid, - host_mail_server_host_uuid uuid, - host_mail_server_mail_server_uuid uuid, - host_mail_server_order integer, - modified_date timestamp with time zone not null -); -ALTER TABLE history.host_mail_servers OWNER TO admin; - -CREATE FUNCTION history_host_mail_servers() RETURNS trigger -AS $$ -DECLARE - history_host_mail_servers RECORD; -BEGIN - SELECT INTO history_host_mail_servers * FROM host_mail_servers WHERE host_mail_server_uuid = new.host_mail_server_uuid; - INSERT INTO history.host_mail_servers - (host_mail_server_uuid, - host_mail_server_host_uuid, - host_mail_server_mail_server_uuid, - host_mail_server_order, - modified_date) - VALUES - (history_host_mail_servers.host_mail_server_uuid, - history_host_mail_servers.host_mail_server_host_uuid, - history_host_mail_servers.host_mail_server_mail_server_uuid, - history_host_mail_servers.host_mail_server_order, - history_host_mail_servers.modified_date); - RETURN NULL; -END; -$$ -LANGUAGE plpgsql; -ALTER FUNCTION history_host_mail_servers() OWNER TO admin; - -CREATE TRIGGER trigger_host_mail_servers - AFTER INSERT OR UPDATE ON host_mail_servers - FOR EACH ROW EXECUTE PROCEDURE history_host_mail_servers(); - - -- This holds user-configurable variable. These values override defaults but NOT configuration files. CREATE TABLE variables ( variable_uuid uuid not null primary key, diff --git a/share/words.xml b/share/words.xml index 56d5f175..bd1bccc4 100644 --- a/share/words.xml +++ b/share/words.xml @@ -805,6 +805,7 @@ Failed to promote the DRBD resource: [#!variable!resource!#] primary. Expected a Disconnected from all databases and closing all open SSH sessions. Will reconnect after the network configuration changes have taken effect. Network reconfiguration is complete! Skipping the OUI parse. The next scheduled parse will be done in: [#!variable!next_parse!#]. Override with '--force'. + The rpm: [#!variable!rpm_path!#] appears to be a problem, removing it. Test diff --git a/tools/striker-manage-install-target b/tools/striker-manage-install-target index 383a3a48..696f7190 100755 --- a/tools/striker-manage-install-target +++ b/tools/striker-manage-install-target @@ -1025,8 +1025,30 @@ sub update_install_source }}); if ($this_stdout_line > $last_stdout_line) { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }}); print $anvil->Words->string({key => "message_0078", variables => { line => $line }})."\n"; + # In some cases, a bad local RPM can cause download failures. This + # checks for and removes them. It can take a few runs to clear out a + # set of bad files, but it will clear out eventually. + if ($line =~ / (.*?.rpm): Interrupted by header callback/i) + { + my $rpm_name = $1; + my $rpm_path = $download_path."/".$rpm_name; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { + rpm_name => $rpm_name, + rpm_path => $rpm_path, + }}); + + if (-e $rpm_path) + { + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, 'print' => 1, key => "log_0469", variables => { rpm_path => $rpm_path }}); + unlink $rpm_path; + + $error_out .= $anvil->Words->string({key => "log_0469", variables => { rpm_path => $rpm_path }})."\n"; + } + } + $last_stdout_line = $this_stdout_line; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { last_stdout_line => $last_stdout_line }}); @@ -1103,7 +1125,7 @@ sub update_install_source update_progress($anvil, 85, ""); $output = ""; - ($output, $return_code) = $anvil->System->call({debug => 2, shell_call => $anvil->data->{path}{exe}{createrepo}." -g ".$comps_xml." ".$repo_path }); + ($output, $return_code) = $anvil->System->call({debug => 2, shell_call => $anvil->data->{path}{exe}{createrepo_c}." -g ".$comps_xml." ".$repo_path }); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { output => $output, return_code => $return_code }}); print $anvil->Words->string({key => "message_0130"})."\n"; update_progress($anvil, 90, "message_0130"); @@ -1280,7 +1302,6 @@ sub load_packages "dnf-data.noarch", "dnf-plugin-subscription-manager.x86_64", "dnf-plugins-core.noarch", - #"dnf-utils.noarch", "dnf.noarch", "dnsmasq.x86_64", "dosfstools.x86_64", @@ -1538,6 +1559,7 @@ sub load_packages "krb5-libs.x86_64", ], l => [ + "langpacks-en.noarch", "lcms2.x86_64", "less.x86_64", diff --git a/tools/test.pl b/tools/test.pl index c243831e..523087c7 100755 --- a/tools/test.pl +++ b/tools/test.pl @@ -20,11 +20,12 @@ if (($running_directory =~ /^\./) && ($ENV{PWD})) # Turn off buffering so that the pinwheel will display while waiting for the SSH call(s) to complete. $| = 1; -#print "Starting test.\n"; +print "Starting test.\n"; my $anvil = Anvil::Tools->new({debug => 3}); $anvil->Log->secure({set => 1}); $anvil->Log->level({set => 2}); +print "Connecting to the database(s);\b"; $anvil->Database->connect({debug => 3}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0132"}); print "DB Connections: [".$anvil->data->{sys}{database}{connections}."]\n";