status: fix tmpfile cleanup
$tmpfilename already gets unlinked after executing the cmd. furthermore, because this is a local file, it is wrong to delete it via the ssh command on a remote node. small change: added \n to the error message. Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
0246225ca7
commit
855915b60d
@ -459,7 +459,7 @@ __PACKAGE__->register_method ({
|
|||||||
# best effort to match apl_download behaviour
|
# best effort to match apl_download behaviour
|
||||||
chmod 0644, $tmpfilename;
|
chmod 0644, $tmpfilename;
|
||||||
|
|
||||||
my $err_cleanup = sub { unlink $dest, $tmpfilename; die "cleanup failed: $!" if $! && $! != ENOENT };
|
my $err_cleanup = sub { unlink $dest; die "cleanup failed: $!\n" if $! && $! != ENOENT };
|
||||||
|
|
||||||
my $cmd;
|
my $cmd;
|
||||||
if ($node ne 'localhost' && $node ne PVE::INotify::nodename()) {
|
if ($node ne 'localhost' && $node ne PVE::INotify::nodename()) {
|
||||||
@ -481,7 +481,7 @@ __PACKAGE__->register_method ({
|
|||||||
|
|
||||||
$cmd = ['/usr/bin/scp', @ssh_options, '-p', '--', $tmpfilename, "[$remip]:" . PVE::Tools::shell_quote($dest)];
|
$cmd = ['/usr/bin/scp', @ssh_options, '-p', '--', $tmpfilename, "[$remip]:" . PVE::Tools::shell_quote($dest)];
|
||||||
|
|
||||||
$err_cleanup = sub { run_command([@remcmd, 'rm', '-f', '--', $dest, $tmpfilename]) };
|
$err_cleanup = sub { run_command([@remcmd, 'rm', '-f', '--', $dest]) };
|
||||||
} else {
|
} else {
|
||||||
PVE::Storage::activate_storage($cfg, $param->{storage});
|
PVE::Storage::activate_storage($cfg, $param->{storage});
|
||||||
File::Path::make_path($dirname);
|
File::Path::make_path($dirname);
|
||||||
|
|||||||
Reference in New Issue
Block a user