This commit is contained in:
Vyacheslav Anzhiganov 2016-10-12 03:18:49 +03:00
parent 828eaf453a
commit f75c502987

View file

@ -71,7 +71,7 @@ class LXC(object):
def __init__(self): def __init__(self):
logging.debug("") logging.debug("")
def list(self, status=None): def list_containers(self, status=None):
""" """
:return: ['container_first', 'container_second'] :return: ['container_first', 'container_second']
""" """
@ -89,7 +89,7 @@ class LXC(object):
""" """
checks if a given container is defined or not checks if a given container is defined or not
""" """
if name in self.list(): if name in self.list_containers():
return True return True
return False return False
@ -100,7 +100,7 @@ class LXC(object):
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)
if name in self.list("running"): if name in self.list_containers("running"):
raise ContainerAlreadyRunning('The container %s is already started!' % name) raise ContainerAlreadyRunning('The container %s is already started!' % name)
cmd = ['lxc-start', '-n', name, '-d'] cmd = ['lxc-start', '-n', name, '-d']