* Fixed a problem with tools/anvil-prep-database being called from the anvil-striker RPM where the local DB password wasn't making it into the hash in time to set the DB password.

* Disabled searching for 'path::config...' files.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 7 years ago
parent 7e63cfbcc4
commit 56045214f2
  1. 4
      Anvil/Tools.pm
  2. 8
      rpm/SPECS/anvil.spec
  3. 32
      tools/anvil-prep-database

@ -929,8 +929,10 @@ sub _set_paths
# Make sure we actually have the requested files. # Make sure we actually have the requested files.
foreach my $type (sort {$a cmp $b} keys %{$anvil->data->{path}}) foreach my $type (sort {$a cmp $b} keys %{$anvil->data->{path}})
{ {
# We don't look for urls because they're relative to the domain. # We don't look for urls because they're relative to the domain. We also don't look for
# configs as we might find backups.
next if $type eq "urls"; next if $type eq "urls";
next if $type eq "configs";
foreach my $file (sort {$a cmp $b} keys %{$anvil->data->{path}{$type}}) foreach my $file (sort {$a cmp $b} keys %{$anvil->data->{path}{$type}})
{ {
if (not -e $anvil->data->{path}{$type}{$file}) if (not -e $anvil->data->{path}{$type}{$file})

@ -3,7 +3,7 @@
%define anvilgroup admin %define anvilgroup admin
Name: anvil Name: anvil
Version: 3.0 Version: 3.0
Release: 8%{?dist} Release: 9%{?dist}
Summary: Alteeve Anvil! complete package. Summary: Alteeve Anvil! complete package.
License: GPLv2+ License: GPLv2+
@ -329,6 +329,7 @@ setenforce 1
%postun striker %postun striker
### TODO: This breaks the repos ### TODO: This breaks the repos
rm -rf /usr/share/anvil
echo "Closing the postgresql ports." echo "Closing the postgresql ports."
#firewall-cmd --zone=public --remove-service=http #firewall-cmd --zone=public --remove-service=http
#firewall-cmd --zone=public --remove-service=http --permanent #firewall-cmd --zone=public --remove-service=http --permanent
@ -363,7 +364,10 @@ systemctl stop postgresql.service
%changelog %changelog
* Thu Jul 13 2018 Madison Kelly <mkelly@alteeve.ca> 3.0-8 * Fri Jul 13 2018 Madison Kelly <mkelly@alteeve.ca> 3.0-9
- Updated the source tarball.
* Fri Jul 13 2018 Madison Kelly <mkelly@alteeve.ca> 3.0-8
- Fixed the path to anvil.sql - Fixed the path to anvil.sql
* Thu Jul 12 2018 Madison Kelly <mkelly@alteeve.ca> 3.0-7 * Thu Jul 12 2018 Madison Kelly <mkelly@alteeve.ca> 3.0-7

@ -57,7 +57,9 @@ if (not $local_uuid)
if ($local_uuid) if ($local_uuid)
{ {
# Start checks # Start checks
my $running = $anvil->System->check_daemon({daemon => $anvil->data->{sys}{service}{postgresql}}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "sys::service::postgresql" => $anvil->data->{sys}{service}{postgresql} }});
my $running = $anvil->System->check_daemon({debug => 2, daemon => $anvil->data->{sys}{service}{postgresql}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { running => $running }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { running => $running }});
if ($running eq "2") if ($running eq "2")
{ {
@ -68,7 +70,13 @@ if ($local_uuid)
elsif (not $running) elsif (not $running)
{ {
# Do we need to initialize the databae? # Do we need to initialize the databae?
if (not -e $anvil->data->{path}{configs}{'pg_hba.conf'}) $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "path::configs::pg_hba.conf" => $anvil->data->{path}{configs}{'pg_hba.conf'} }});
if (-e $anvil->data->{path}{configs}{'pg_hba.conf'})
{
# It already exists.
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "path::configs::pg_hba.conf" => $anvil->data->{path}{configs}{'pg_hba.conf'} }});
}
else
{ {
# Initialize. # Initialize.
my $output = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{'postgresql-setup'}." initdb", source => $THIS_FILE, line => __LINE__}); my $output = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{'postgresql-setup'}." initdb", source => $THIS_FILE, line => __LINE__});
@ -189,7 +197,7 @@ if ($local_uuid)
} }
# Start the daemon. '0' = started, anything else is a problem. # Start the daemon. '0' = started, anything else is a problem.
my $return_code = $anvil->System->start_daemon({daemon => $anvil->data->{sys}{service}{postgresql}}); my $return_code = $anvil->System->start_daemon({debug => 2, daemon => $anvil->data->{sys}{service}{postgresql}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { return_code => $return_code }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { return_code => $return_code }});
if ($return_code eq "0") if ($return_code eq "0")
{ {
@ -432,10 +440,14 @@ sub add_to_local_config
}}); }});
# Setup the data we'll insert. The password will be changed after the user does the initial config. # Setup the data we'll insert. The password will be changed after the user does the initial config.
my $insert = "database::".$host_uuid."::host = localhost\n"; $anvil->data->{database}{$host_uuid}{host} = "localhost";
$insert .= "database::".$host_uuid."::port = 5432\n"; $anvil->data->{database}{$host_uuid}{port} = "5432";
$insert .= "database::".$host_uuid."::password = Initial1\n"; $anvil->data->{database}{$host_uuid}{password} = "Initial1";
$insert .= "database::".$host_uuid."::ping = 0\n\n"; $anvil->data->{database}{$host_uuid}{ping} = "0";
my $insert = "database::".$host_uuid."::host = ".$anvil->data->{database}{$host_uuid}{host}."\n";
$insert .= "database::".$host_uuid."::port = ".$anvil->data->{database}{$host_uuid}{port}."\n";
$insert .= "database::".$host_uuid."::password = ".$anvil->data->{database}{$host_uuid}{password}."\n";
$insert .= "database::".$host_uuid."::ping = ".$anvil->data->{database}{$host_uuid}{ping}."\n\n";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { insert => $insert }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { insert => $insert }});
# Now inject the config. # Now inject the config.
@ -464,6 +476,7 @@ sub add_to_local_config
} }
# If we're here, we're ready to write it out. # If we're here, we're ready to write it out.
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { config_seen => $config_seen }});
if (not $config_seen) if (not $config_seen)
{ {
# Backup the original # Backup the original
@ -472,7 +485,7 @@ sub add_to_local_config
# Now update! # Now update!
$anvil->Storage->write_file({ $anvil->Storage->write_file({
debug => 3, debug => 2,
file => $anvil->data->{path}{configs}{'anvil.conf'}, file => $anvil->data->{path}{configs}{'anvil.conf'},
body => $new_body, body => $new_body,
user => "admin", user => "admin",
@ -484,9 +497,6 @@ sub add_to_local_config
# Record the local UUID for returning to the caller. # Record the local UUID for returning to the caller.
$local_uuid = $host_uuid; $local_uuid = $host_uuid;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { local_uuid => $local_uuid }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { local_uuid => $local_uuid }});
# Re-read the new config.
$anvil->Storage->read_config({file => $anvil->data->{path}{configs}{'anvil.conf'}});
} }
return($local_uuid); return($local_uuid);

Loading…
Cancel
Save