mirror of https://github.com/docker/docs.git
Quieter log output when recreating
Moved log stuff to Service, which I think makes more sense anyway. Maybe.
This commit is contained in:
parent
ea4753c49a
commit
8c583d1bb2
|
@ -1,8 +1,5 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import logging
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
class Container(object):
|
class Container(object):
|
||||||
"""
|
"""
|
||||||
|
@ -91,19 +88,15 @@ class Container(object):
|
||||||
return self.dictionary['State']['Running']
|
return self.dictionary['State']['Running']
|
||||||
|
|
||||||
def start(self, **options):
|
def start(self, **options):
|
||||||
log.info("Starting %s..." % self.name)
|
|
||||||
return self.client.start(self.id, **options)
|
return self.client.start(self.id, **options)
|
||||||
|
|
||||||
def stop(self, **options):
|
def stop(self, **options):
|
||||||
log.info("Stopping %s..." % self.name)
|
|
||||||
return self.client.stop(self.id, **options)
|
return self.client.stop(self.id, **options)
|
||||||
|
|
||||||
def kill(self):
|
def kill(self):
|
||||||
log.info("Killing %s..." % self.name)
|
|
||||||
return self.client.kill(self.id)
|
return self.client.kill(self.id)
|
||||||
|
|
||||||
def remove(self):
|
def remove(self):
|
||||||
log.info("Removing %s..." % self.name)
|
|
||||||
return self.client.remove_container(self.id)
|
return self.client.remove_container(self.id)
|
||||||
|
|
||||||
def inspect_if_not_inspected(self):
|
def inspect_if_not_inspected(self):
|
||||||
|
|
|
@ -43,19 +43,23 @@ class Service(object):
|
||||||
def start(self, **options):
|
def start(self, **options):
|
||||||
for c in self.containers(stopped=True):
|
for c in self.containers(stopped=True):
|
||||||
if not c.is_running:
|
if not c.is_running:
|
||||||
|
log.info("Starting %s..." % c.name)
|
||||||
self.start_container(c, **options)
|
self.start_container(c, **options)
|
||||||
|
|
||||||
def stop(self, **options):
|
def stop(self, **options):
|
||||||
for c in self.containers():
|
for c in self.containers():
|
||||||
|
log.info("Stopping %s..." % c.name)
|
||||||
c.stop(**options)
|
c.stop(**options)
|
||||||
|
|
||||||
def kill(self, **options):
|
def kill(self, **options):
|
||||||
for c in self.containers():
|
for c in self.containers():
|
||||||
|
log.info("Killing %s..." % c.name)
|
||||||
c.kill(**options)
|
c.kill(**options)
|
||||||
|
|
||||||
def remove_stopped(self, **options):
|
def remove_stopped(self, **options):
|
||||||
for c in self.containers(stopped=True):
|
for c in self.containers(stopped=True):
|
||||||
if not c.is_running:
|
if not c.is_running:
|
||||||
|
log.info("Removing %s..." % c.name)
|
||||||
c.remove(**options)
|
c.remove(**options)
|
||||||
|
|
||||||
def create_container(self, one_off=False, **override_options):
|
def create_container(self, one_off=False, **override_options):
|
||||||
|
@ -81,12 +85,14 @@ class Service(object):
|
||||||
containers = self.containers(stopped=True)
|
containers = self.containers(stopped=True)
|
||||||
|
|
||||||
if len(containers) == 0:
|
if len(containers) == 0:
|
||||||
|
log.info("Creating %s..." % self.next_container_name())
|
||||||
return ([], [self.create_container(**override_options)])
|
return ([], [self.create_container(**override_options)])
|
||||||
else:
|
else:
|
||||||
old_containers = []
|
old_containers = []
|
||||||
new_containers = []
|
new_containers = []
|
||||||
|
|
||||||
for c in containers:
|
for c in containers:
|
||||||
|
log.info("Recreating %s..." % c.name)
|
||||||
(old_container, new_container) = self.recreate_container(c, **override_options)
|
(old_container, new_container) = self.recreate_container(c, **override_options)
|
||||||
old_containers.append(old_container)
|
old_containers.append(old_container)
|
||||||
new_containers.append(new_container)
|
new_containers.append(new_container)
|
||||||
|
|
Loading…
Reference in New Issue