* Tested that the new remote Storage->read_file() works and removed some test code.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 7 years ago
parent 188cab5ec0
commit b42d4a6fea
  1. 13
      Anvil/Tools/Storage.pm
  2. 16
      tools/anvil-configure-network

@ -968,6 +968,9 @@ sub read_file
$anvil->data->{cache}{file}{$temp_file} = $body; $anvil->data->{cache}{file}{$temp_file} = $body;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { "cache::file::${temp_file}" => $anvil->data->{cache}{file}{$temp_file} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { "cache::file::${temp_file}" => $anvil->data->{cache}{file}{$temp_file} }});
} }
# Remove the temp file.
unlink $temp_file;
} }
else else
{ {
@ -1173,6 +1176,8 @@ If this is set to C<< 1 >>, and if a conflict is found with the SSH RSA key (C<<
B<< NOTE >>: This is the default to better handle a rebuilt node, dashboard or DR machine. Of course, this is a possible security problem so please consider it's use on a case by case basis. B<< NOTE >>: This is the default to better handle a rebuilt node, dashboard or DR machine. Of course, this is a possible security problem so please consider it's use on a case by case basis.
=cut =cut
### TODO: Make is so that if both the source and destination are remote, we setup to copy from the source to
### the destination (or ping via us, would be easier but possibly slower if we're remote).
sub rsync sub rsync
{ {
my $self = shift; my $self = shift;
@ -1224,8 +1229,8 @@ sub rsync
# the current user's ~/.ssh/known_hosts file. # the current user's ~/.ssh/known_hosts file.
if ($source =~ /^(.*?)@(.*?):/) if ($source =~ /^(.*?)@(.*?):/)
{ {
$remote_user = $1; $remote_user = $1;
$target = $2; $target = $2;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => {
remote_user => $remote_user, remote_user => $remote_user,
target => $target, target => $target,
@ -1233,8 +1238,8 @@ sub rsync
} }
elsif ($destination =~ /^(.*?)@(.*?):/) elsif ($destination =~ /^(.*?)@(.*?):/)
{ {
$remote_user = $1; $remote_user = $1;
$target = $2; $target = $2;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => {
remote_user => $remote_user, remote_user => $remote_user,
target => $target, target => $target,

@ -59,22 +59,6 @@ if (not $connections)
$anvil->nice_exit({exit_code => 2}); $anvil->nice_exit({exit_code => 2});
} }
$anvil->Storage->write_file({
debug => 2,
body => "This is only a test.\n",
file => "/home/admin/test.file",
group => "admin",
mode => "0644",
overwrite => 0,
port => 22,
password => "Initial1",
target => "192.168.122.202",
user => "admin",
remote_user => "admin",
});
die "Testing...\n";
pickup_job_details($anvil); pickup_job_details($anvil);
reconfigure_network($anvil); reconfigure_network($anvil);

Loading…
Cancel
Save