From 4d46f06c7355f766b5a366e83e037cca695e1274 Mon Sep 17 00:00:00 2001 From: zhong Date: Wed, 6 Apr 2016 10:37:50 +0800 Subject: [PATCH] fix bug of stop container #14 --- src/container.py | 2 +- src/lvmtool.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/container.py b/src/container.py index 59e1f95..4843b9a 100755 --- a/src/container.py +++ b/src/container.py @@ -255,7 +255,7 @@ IP=%s def container_status(self, lxc_name): if not self.is_container(lxc_name): return [False, "container not found"] - Ret = sys_run("lxc-info -n %s | grep RUNNING") + Ret = sys_run("lxc-info -n %s | grep RUNNING" % lxc_name) #status = subprocess.call([self.libpath+"/lxc_control.sh", "status", lxc_name]) if Ret.returncode == 0: return [True, 'running'] diff --git a/src/lvmtool.py b/src/lvmtool.py index 152f83e..d385470 100755 --- a/src/lvmtool.py +++ b/src/lvmtool.py @@ -3,8 +3,8 @@ import env,subprocess,os,time from log import logger -def sys_run(command): - Ret = subprocess.run(command, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, shell=True, check=False) +def sys_run(command,check=False): + Ret = subprocess.run(command, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, shell=True, check=check) return Ret def new_group(group_name, size = "5000", file_path = "/opt/docklet/local/docklet-storage"):