* Fixed a bug where backing up a file on a remote machine returned a failure, if the target backup directory had to be created (even if it was created successfully).

* Fixed a bug in a mini bash command to chmod / chown a directory being created on a remote machine.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent f3bbec53ef
commit ec192d9041
  1. 4
      Anvil/Tools/Database.pm
  2. 15
      Anvil/Tools/Storage.pm
  3. 2
      tools/striker-initialize-host

@ -13606,6 +13606,7 @@ sub manage_anvil_conf
secure => 1, secure => 1,
target => $target, target => $target,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { anvil_conf => $anvil_conf }});
if ($anvil_conf eq "!!error!!") if ($anvil_conf eq "!!error!!")
{ {
@ -13891,6 +13892,7 @@ sub manage_anvil_conf
# Now update! # Now update!
my ($failed) = $anvil->Storage->write_file({ my ($failed) = $anvil->Storage->write_file({
debug => $debug,
secure => 1, secure => 1,
file => $anvil->data->{path}{configs}{'anvil.conf'}, file => $anvil->data->{path}{configs}{'anvil.conf'},
body => $new_body, body => $new_body,
@ -13906,7 +13908,7 @@ sub manage_anvil_conf
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { failed => $failed }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { failed => $failed }});
if ($failed) if ($failed)
{ {
# Simething went weong. # Something went weong.
return(1); return(1);
} }

@ -1223,6 +1223,9 @@ fi";
port => $port, port => $port,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { failed => $failed }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { failed => $failed }});
if ($failed)
{
# Failed to create the directory, abort.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0170", variables => { $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0170", variables => {
method => "copy_file", method => "copy_file",
source_file => $source_file, source_file => $source_file,
@ -1230,6 +1233,7 @@ fi";
}}); }});
return(1); return(1);
} }
}
# Now backup the file. # Now backup the file.
my ($output, $error, $return_code) = $anvil->Remote->call({ my ($output, $error, $return_code) = $anvil->Remote->call({
@ -1719,22 +1723,21 @@ else
"; ";
if ($mode) if ($mode)
{ {
$shell_call .= " ".$anvil->data->{path}{exe}{'chmod'}." ".$mode."\n"; $shell_call .= " ".$anvil->data->{path}{exe}{'chmod'}." ".$mode." ".$working_directory."\n";
} }
if (($user) && ($group)) if (($user) && ($group))
{ {
$shell_call .= " ".$anvil->data->{path}{exe}{'chown'}." ".$user.":".$group."\n"; $shell_call .= " ".$anvil->data->{path}{exe}{'chown'}." ".$user.":".$group." ".$working_directory."\n";
} }
elsif ($user) elsif ($user)
{ {
$shell_call .= " ".$anvil->data->{path}{exe}{'chown'}." ".$user.":\n"; $shell_call .= " ".$anvil->data->{path}{exe}{'chown'}." ".$user.": ".$working_directory."\n";
} }
elsif ($group) elsif ($group)
{ {
$shell_call .= " ".$anvil->data->{path}{exe}{'chown'}." :".$group."\n"; $shell_call .= " ".$anvil->data->{path}{exe}{'chown'}." :".$group." ".$working_directory."\n";
} }
$shell_call .= " $shell_call .= " if [ -d '".$working_directory."' ];
if [ -d '".$working_directory."' ];
then then
".$anvil->data->{path}{exe}{echo}." 'created' ".$anvil->data->{path}{exe}{echo}." 'created'
else else

@ -155,7 +155,7 @@ sub add_databases
first => $local_host, first => $local_host,
second => $target, second => $target,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { match => $match }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { match => $match }});
# We'll sort in reverse order, so if there is a BCN address, we'll use it. # We'll sort in reverse order, so if there is a BCN address, we'll use it.
my $host_uuid = $anvil->data->{sys}{host_uuid}; my $host_uuid = $anvil->data->{sys}{host_uuid};

Loading…
Cancel
Save