* 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. 31
      Anvil/Tools/Storage.pm
  3. 2
      tools/striker-initialize-host

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

@ -1223,12 +1223,16 @@ fi";
port => $port,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { failed => $failed }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0170", variables => {
method => "copy_file",
source_file => $source_file,
target_file => $target_file,
}});
return(1);
if ($failed)
{
# Failed to create the directory, abort.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0170", variables => {
method => "copy_file",
source_file => $source_file,
target_file => $target_file,
}});
return(1);
}
}
# Now backup the file.
@ -1713,28 +1717,27 @@ sub make_directory
my $shell_call = "
if [ -d '".$working_directory."' ];
then
".$anvil->data->{path}{exe}{echo}." 'exists'
".$anvil->data->{path}{exe}{echo}." 'exists'
else
".$anvil->data->{path}{exe}{'mkdir'}." $working_directory
".$anvil->data->{path}{exe}{'mkdir'}." $working_directory
";
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))
{
$shell_call .= " ".$anvil->data->{path}{exe}{'chown'}." ".$user.":".$group."\n";
$shell_call .= " ".$anvil->data->{path}{exe}{'chown'}." ".$user.":".$group." ".$working_directory."\n";
}
elsif ($user)
{
$shell_call .= " ".$anvil->data->{path}{exe}{'chown'}." ".$user.":\n";
$shell_call .= " ".$anvil->data->{path}{exe}{'chown'}." ".$user.": ".$working_directory."\n";
}
elsif ($group)
{
$shell_call .= " ".$anvil->data->{path}{exe}{'chown'}." :".$group."\n";
$shell_call .= " ".$anvil->data->{path}{exe}{'chown'}." :".$group." ".$working_directory."\n";
}
$shell_call .= "
if [ -d '".$working_directory."' ];
$shell_call .= " if [ -d '".$working_directory."' ];
then
".$anvil->data->{path}{exe}{echo}." 'created'
else

@ -155,7 +155,7 @@ sub add_databases
first => $local_host,
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.
my $host_uuid = $anvil->data->{sys}{host_uuid};

Loading…
Cancel
Save