[pve-devel] [PATCH pve-container 2/2] Return proper error message when CT is not running for pct exec

Emmanuel Kasper e.kasper at proxmox.com
Wed Dec 13 12:28:33 CET 2017


instead of the uglier
lx-attach: : attach.c: lxc_attach: 794 Failed to attach and multiple tabs

Signed-off-by: Emmanuel Kasper <e.kasper at proxmox.com>
---
 src/PVE/CLI/pct.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 1818551..d44ed6c 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -191,6 +191,9 @@ __PACKAGE__->register_method ({
 	# test if container exists on this node
 	PVE::LXC::Config->load_config($vmid);
 
+	die "Error: container '$vmid' not running!\n"
+	    if !PVE::LXC::check_running($vmid);
+
 	exec('lxc-attach', '-n', $param->{vmid}, '--', @args);
     }});
 
-- 
2.11.0





More information about the pve-devel mailing list