container_delete
This commit is contained in:
parent
87d71f6634
commit
e68a947a6b
1 changed files with 14 additions and 11 deletions
|
@ -114,9 +114,13 @@ class lxc():
|
||||||
if not self.exists(name):
|
if not self.exists(name):
|
||||||
raise ContainerNotExists("The container (%s) does not exist!" % name)
|
raise ContainerNotExists("The container (%s) does not exist!" % name)
|
||||||
|
|
||||||
cmd = ['lxc-stop', '-n', name]
|
cmd = ['/usr/bin/lxc-stop', '-n', name]
|
||||||
|
|
||||||
return subprocess.check_call(cmd)
|
try:
|
||||||
|
result = subprocess.check_call(cmd)
|
||||||
|
return True
|
||||||
|
exception Exception as e:
|
||||||
|
return False
|
||||||
|
|
||||||
def destroy(self, name):
|
def destroy(self, name):
|
||||||
"""
|
"""
|
||||||
|
@ -387,4 +391,3 @@ class lxc():
|
||||||
# _monitor = None
|
# _monitor = None
|
||||||
# signal.signal(signal.SIGTERM, signal.SIG_DFL)
|
# signal.signal(signal.SIGTERM, signal.SIG_DFL)
|
||||||
# signal.signal(signal.SIGINT, signal.SIG_DFL)
|
# signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue