diff --git a/share/words.xml b/share/words.xml index 5c4bf03c..91ff0d07 100644 --- a/share/words.xml +++ b/share/words.xml @@ -2060,6 +2060,7 @@ The file: [#!variable!file!#] needs to be updated. The difference is: Opening the firewall zone: [#!variable!zone!#] to allow the service: [#!variable!service!#]. No password for the database on the host with UUID: [#!variable!uuid!#], skipping it. The firewalld daemon isn't running, skipping firewall setup. + The postgresql server is installed. The host name: [#!variable!target!#] does not resolve to an IP address. @@ -3084,6 +3085,7 @@ The error was: We will sleep a bit and try again. [ Warning ] - The storage group: [#!variable!storage_group_name!#] had the host: [#!variable!host_name!#] as a member. This host is not a member (anymore?) of the Anvil!: [#!variable!anvil_name!#]. Removing it from the storage group now. + [ Warning ] - The postgresql server is not installed yet. Sleeping for a bit, then will check again. diff --git a/tools/striker-prep-database b/tools/striker-prep-database index a2b50b8e..22c3db58 100755 --- a/tools/striker-prep-database +++ b/tools/striker-prep-database @@ -29,6 +29,8 @@ $| = 1; my $anvil = Anvil::Tools->new(); $anvil->Get->switches; +$anvil->Log->level({set => 2}); +$anvil->Log->secure({set => 1}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0115", variables => { program => $THIS_FILE }}); $anvil->System->_check_anvil_conf({debug => 2}); @@ -52,15 +54,36 @@ if ($local_uuid) # Check that the firewall is open. configure_firewall($anvil); - my $running = $anvil->System->check_daemon({debug => 2, daemon => $anvil->data->{sys}{daemon}{postgresql}}); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { running => $running }}); - if ($running eq "2") + # Wait until postgresql is installed, in case we're running during initial dnf install. + my $installed = 0; + until($installed) { - # Not installed. - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0144"}); - $anvil->nice_exit({exit_code => 5}); + my $shell_call = $anvil->data->{path}{exe}{rpm}." -q postgresql-server"; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { shell_call => $shell_call }}); + + my ($output, $return_code) = $anvil->System->call({shell_call => $shell_call, debug => 2, source => $THIS_FILE, line => __LINE__}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { + output => $output, + return_code => $return_code, + }}); + + if ($return_code) + { + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "warning_0131"}); + sleep 5; + } + else + { + # Installed. + $installed = 1; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { installed => $installed }}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0670"}); + } } - elsif (not $running) + + my $running = $anvil->System->check_daemon({debug => 2, daemon => $anvil->data->{sys}{daemon}{postgresql}}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { running => $running }}); + if (not $running) { # Do we need to initialize the databae? $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "path::configs::pg_hba.conf" => $anvil->data->{path}{configs}{'pg_hba.conf'} }}); @@ -411,7 +434,7 @@ if ($local_uuid) } # Remove the temporary password file. - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { created_pgpass => $created_pgpass, "path::secure::postgres_pgpass" => $anvil->data->{path}{secure}{postgres_pgpass}, }});