* 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 <digimer@alteeve.ca>
main
Digimer 5 years ago
parent e764eccf6e
commit 4cf9d6215c
  1. 3
      Anvil/Tools.pm
  2. 6
      Anvil/Tools/Database.pm
  3. 4
      rpm/SPECS/anvil.spec
  4. 54
      share/anvil.sql
  5. 1
      share/words.xml
  6. 26
      tools/striker-manage-install-target
  7. 3
      tools/test.pl

@ -891,7 +891,6 @@ sub _set_defaults
"recipients", "recipients",
"notifications", "notifications",
"mail_servers", "mail_servers",
"host_mail_servers",
"variables", "variables",
"jobs", "jobs",
"network_interfaces", "network_interfaces",
@ -1128,7 +1127,7 @@ sub _set_paths
cibadmin => "/usr/sbin/cibadmin", cibadmin => "/usr/sbin/cibadmin",
cp => "/usr/bin/cp", cp => "/usr/bin/cp",
createdb => "/usr/bin/createdb", createdb => "/usr/bin/createdb",
createrepo => "/usr/bin/createrepo", createrepo_c => "/usr/bin/createrepo_c",
createuser => "/usr/bin/createuser", createuser => "/usr/bin/createuser",
crm_error => "/usr/sbin/crm_error", crm_error => "/usr/sbin/crm_error",
dmidecode => "/usr/sbin/dmidecode", dmidecode => "/usr/sbin/dmidecode",

@ -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_host_uuid} = $notification_host_uuid;
$anvil->data->{notifications}{notification_uuid}{$notification_uuid}{notification_alert_level} = $notification_alert_level; $anvil->data->{notifications}{notification_uuid}{$notification_uuid}{notification_alert_level} = $notification_alert_level;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $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_recipient_uuid" => $anvil->data->{notifications}{notification_uuid}{$notification_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_host_uuid" => $anvil->data->{notifications}{notification_uuid}{$notification_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_alert_level" => $anvil->data->{notifications}{notification_uuid}{$notification_uuid}{notification_alert_level},
}}); }});
} }

@ -354,9 +354,9 @@ fi
%changelog %changelog
* tbd Madison Kelly <mkelly@alteeve.ca> 3.0-31 * Mon Jan 6 2020 Madison Kelly <mkelly@alteeve.ca> 3.0-31
- Added perl-Mail-RFC822-Address to core requirements. - Added perl-Mail-RFC822-Address to core requirements.
- - Updated source.
* Fri Dec 13 2019 Madison Kelly <mkelly@alteeve.ca> 3.0-30 * Fri Dec 13 2019 Madison Kelly <mkelly@alteeve.ca> 3.0-30
- Enabled/started chronyd in core's post. - Enabled/started chronyd in core's post.

@ -617,60 +617,6 @@ CREATE TRIGGER trigger_mail_servers
FOR EACH ROW EXECUTE PROCEDURE history_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. -- This holds user-configurable variable. These values override defaults but NOT configuration files.
CREATE TABLE variables ( CREATE TABLE variables (
variable_uuid uuid not null primary key, variable_uuid uuid not null primary key,

@ -805,6 +805,7 @@ Failed to promote the DRBD resource: [#!variable!resource!#] primary. Expected a
<key name="log_0466">Disconnected from all databases and closing all open SSH sessions. Will reconnect after the network configuration changes have taken effect.</key> <key name="log_0466">Disconnected from all databases and closing all open SSH sessions. Will reconnect after the network configuration changes have taken effect.</key>
<key name="log_0467">Network reconfiguration is complete!</key> <key name="log_0467">Network reconfiguration is complete!</key>
<key name="log_0468">Skipping the OUI parse. The next scheduled parse will be done in: [#!variable!next_parse!#]. Override with '--force'.</key> <key name="log_0468">Skipping the OUI parse. The next scheduled parse will be done in: [#!variable!next_parse!#]. Override with '--force'.</key>
<key name="log_0469">The rpm: [#!variable!rpm_path!#] appears to be a problem, removing it.</key>
<!-- Test words. Do NOT change unless you update 't/Words.t' or tests will needlessly fail. --> <!-- Test words. Do NOT change unless you update 't/Words.t' or tests will needlessly fail. -->
<key name="t_0000">Test</key> <key name="t_0000">Test</key>

@ -1025,8 +1025,30 @@ sub update_install_source
}}); }});
if ($this_stdout_line > $last_stdout_line) 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"; 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; $last_stdout_line = $this_stdout_line;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { last_stdout_line => $last_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, ""); update_progress($anvil, 85, "");
$output = ""; $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 }}); $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"; print $anvil->Words->string({key => "message_0130"})."\n";
update_progress($anvil, 90, "message_0130"); update_progress($anvil, 90, "message_0130");
@ -1280,7 +1302,6 @@ sub load_packages
"dnf-data.noarch", "dnf-data.noarch",
"dnf-plugin-subscription-manager.x86_64", "dnf-plugin-subscription-manager.x86_64",
"dnf-plugins-core.noarch", "dnf-plugins-core.noarch",
#"dnf-utils.noarch",
"dnf.noarch", "dnf.noarch",
"dnsmasq.x86_64", "dnsmasq.x86_64",
"dosfstools.x86_64", "dosfstools.x86_64",
@ -1538,6 +1559,7 @@ sub load_packages
"krb5-libs.x86_64", "krb5-libs.x86_64",
], ],
l => [ l => [
"langpacks-en.noarch", "langpacks-en.noarch",
"lcms2.x86_64", "lcms2.x86_64",
"less.x86_64", "less.x86_64",

@ -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. # Turn off buffering so that the pinwheel will display while waiting for the SSH call(s) to complete.
$| = 1; $| = 1;
#print "Starting test.\n"; print "Starting test.\n";
my $anvil = Anvil::Tools->new({debug => 3}); my $anvil = Anvil::Tools->new({debug => 3});
$anvil->Log->secure({set => 1}); $anvil->Log->secure({set => 1});
$anvil->Log->level({set => 2}); $anvil->Log->level({set => 2});
print "Connecting to the database(s);\b";
$anvil->Database->connect({debug => 3}); $anvil->Database->connect({debug => 3});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0132"}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0132"});
print "DB Connections: [".$anvil->data->{sys}{database}{connections}."]\n"; print "DB Connections: [".$anvil->data->{sys}{database}{connections}."]\n";

Loading…
Cancel
Save