From ebfecf39c398c72392cc01bfbee82c0d9bb0609b Mon Sep 17 00:00:00 2001 From: Digimer Date: Tue, 23 Mar 2021 06:01:45 -0400 Subject: [PATCH] * Updated Database->manage_anvil_conf() to not manually create a backup, as Storage->write_file() creates a backup anyway (so we were getting two backups per one change). * Updated Storage->write_file() to add a short UUID suffix to the temp file before rsync'ing to the target to help avoid source temp file name collisions in parallel running copies to different targets. Signed-off-by: Digimer --- Anvil/Tools/Database.pm | 16 ++-------------- Anvil/Tools/Storage.pm | 8 +++++++- notes | 5 ++++- share/words.xml | 1 + 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Anvil/Tools/Database.pm b/Anvil/Tools/Database.pm index 88503dc9..c14f513c 100644 --- a/Anvil/Tools/Database.pm +++ b/Anvil/Tools/Database.pm @@ -13878,19 +13878,7 @@ sub manage_anvil_conf if ($rewrite) { - # Backup the original - my $backup_file = $anvil->Storage->backup({ - debug => 2, - secure => 1, - file => $anvil->data->{path}{configs}{'anvil.conf'}, - password => $password, - port => $port, - remote_user => $remote_user, - target => $target, - }); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { backup_file => $backup_file }}); - - # Now update! + # Now update! This will back up the file as well. my ($failed) = $anvil->Storage->write_file({ debug => $debug, secure => 1, @@ -13908,7 +13896,7 @@ sub manage_anvil_conf $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { failed => $failed }}); if ($failed) { - # Something went weong. + # Something went wrong. return(1); } diff --git a/Anvil/Tools/Storage.pm b/Anvil/Tools/Storage.pm index 6072a484..d6f65b7d 100644 --- a/Anvil/Tools/Storage.pm +++ b/Anvil/Tools/Storage.pm @@ -3936,7 +3936,8 @@ fi"; my $temp_file = $file; $temp_file =~ s/\//_/g; $temp_file =~ s/^_//g; - $temp_file = "/tmp/".$temp_file; + $temp_file = "/tmp/".$temp_file; + $temp_file .= ".".$anvil->Get->uuid({debug => $debug, short => 1}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { temp_file => $temp_file }}); $anvil->Storage->write_file({ body => $body, @@ -3968,6 +3969,11 @@ fi"; { # Something went wrong writing it. $error = 1; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { error => $error }}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "warning_0081", variables => { + temp_file => $temp_file, + target => $remote_user."\@".$target.":".$file, + }}); } } } diff --git a/notes b/notes index cf8509af..ce78c0ad 100644 --- a/notes +++ b/notes @@ -9,7 +9,10 @@ TODO: Jenkins; -- +Initial setup: +export NODE_NAME=anvil-ci-bm +export python=python3 +./ci-update-yum ============ diff --git a/share/words.xml b/share/words.xml index 11bf252b..78d8370e 100644 --- a/share/words.xml +++ b/share/words.xml @@ -2321,6 +2321,7 @@ Read UUID: .... [#!variable!read_uuid!#] [ Warning ] - Not installing the Alteeve repo! The package: [#!variable!anvil_role_rpm!#] is already installed. This is OK, but be aware that updates from Alteeve will not be available. To change this, please install: [#!variable!alteeve_repo!#]. [ Warning ] - Failed to read the JSON formatted output of 'lsblk'. Expected the return code '0' but received: [#!variable!return_code!#]. The output, if any, was: [#!variable!output!#]. [ Warning ] - Failed to read the XML formatted output of 'lshw'. Expected the return code '0' but received: [#!variable!return_code!#]. The output, if any, was: [#!variable!output!#]. + [ Warning ] - The temporary file: [#!variable!temp_file!#] vanished (or failed to be created) before it could be copied to: [#!variable!target!#].