]> git.proxmox.com Git - pve-storage.git/commitdiff
api: status: import run_command
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 29 Jul 2021 15:11:41 +0000 (17:11 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 29 Jul 2021 15:12:40 +0000 (17:12 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/API2/Storage/Status.pm

index 13bf4b4044212f1baae48111db14bbd66103e06f..2800ad23c3e633e56b5f6807b7f02a7cc11df1bd 100644 (file)
@@ -13,7 +13,7 @@ use PVE::JSONSchema qw(get_standard_option);
 use PVE::RESTHandler;
 use PVE::RPCEnvironment;
 use PVE::RRD;
-use PVE::Tools;
+use PVE::Tools qw(run_command);
 
 use PVE::API2::Storage::Content;
 use PVE::API2::Storage::FileRestore;
@@ -456,15 +456,15 @@ __PACKAGE__->register_method ({
 
            my @remcmd = ('/usr/bin/ssh', @ssh_options, $remip, '--');
 
-           eval {
-               # activate remote storage
-               PVE::Tools::run_command([@remcmd, '/usr/sbin/pvesm', 'status',
-                                        '--storage', $param->{storage}]);
+           eval { # activate remote storage
+               run_command([@remcmd, '/usr/sbin/pvesm', 'status', '--storage', $param->{storage}]);
            };
            die "can't activate storage '$param->{storage}' on node '$node': $@\n" if $@;
 
-           PVE::Tools::run_command([@remcmd, '/bin/mkdir', '-p', '--', PVE::Tools::shell_quote($dirname)],
-                                   errmsg => "mkdir failed");
+           run_command(
+               [@remcmd, '/bin/mkdir', '-p', '--', PVE::Tools::shell_quote($dirname)],
+               errmsg => "mkdir failed",
+           );
  
            $cmd = ['/usr/bin/scp', @ssh_options, '-p', '--', $tmpfilename, "[$remip]:" . PVE::Tools::shell_quote($dest)];
            $err_cmd = [@remcmd, 'unlink', '--', $dest];
@@ -484,9 +484,9 @@ __PACKAGE__->register_method ({
            print "file size is: $size\n";
            print "command: " . join(' ', @$cmd) . "\n";
 
-           eval { PVE::Tools::run_command($cmd, errmsg => 'import failed'); };
+           eval { run_command($cmd, errmsg => 'import failed'); };
            if (my $err = $@) {
-               eval { PVE::Tools::run_command($err_cmd); };
+               eval { run_command($err_cmd) };
                die $err;
            }
            print "finished file import successfully\n";