]> git.proxmox.com Git - pve-container.git/commitdiff
pct exec: do running check earlier
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 16 Jun 2021 14:05:51 +0000 (16:05 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 16 Jun 2021 14:11:58 +0000 (16:11 +0200)
So that both VMID and state related checks are grouped together.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/CLI/pct.pm

index 0211bee2fa3f79032db0caa546ee6653e786abce..0e00b310aeb3699f00f659fa3a8db50c5433c394 100755 (executable)
@@ -184,12 +184,10 @@ __PACKAGE__->register_method ({
 
        my $vmid = $param->{vmid};
        PVE::LXC::Config->load_config($vmid); # test if container exists on this node
-
-       if (!@{$param->{'extra-args'}}) {
-           die "missing command";
-       }
        die "Error: container '$vmid' not running!\n" if !PVE::LXC::check_running($vmid);
 
+       die "missing command" if !@{$param->{'extra-args'}};
+
        exec('lxc-attach', '-n', $vmid, '--', @{$param->{'extra-args'}});
     }});