From 8c583d1bb2f53f336437bb89821093c258cc21e6 Mon Sep 17 00:00:00 2001 From: Aanand Prasad Date: Wed, 15 Jan 2014 18:06:49 +0000 Subject: [PATCH] Quieter log output when recreating Moved log stuff to Service, which I think makes more sense anyway. Maybe. --- fig/container.py | 7 ------- fig/service.py | 6 ++++++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fig/container.py b/fig/container.py index 9556ec1f6f..24b239ac69 100644 --- a/fig/container.py +++ b/fig/container.py @@ -1,8 +1,5 @@ from __future__ import unicode_literals from __future__ import absolute_import -import logging - -log = logging.getLogger(__name__) class Container(object): """ @@ -91,19 +88,15 @@ class Container(object): return self.dictionary['State']['Running'] def start(self, **options): - log.info("Starting %s..." % self.name) return self.client.start(self.id, **options) def stop(self, **options): - log.info("Stopping %s..." % self.name) return self.client.stop(self.id, **options) def kill(self): - log.info("Killing %s..." % self.name) return self.client.kill(self.id) def remove(self): - log.info("Removing %s..." % self.name) return self.client.remove_container(self.id) def inspect_if_not_inspected(self): diff --git a/fig/service.py b/fig/service.py index c9a36499f1..e730041013 100644 --- a/fig/service.py +++ b/fig/service.py @@ -43,19 +43,23 @@ class Service(object): def start(self, **options): for c in self.containers(stopped=True): if not c.is_running: + log.info("Starting %s..." % c.name) self.start_container(c, **options) def stop(self, **options): for c in self.containers(): + log.info("Stopping %s..." % c.name) c.stop(**options) def kill(self, **options): for c in self.containers(): + log.info("Killing %s..." % c.name) c.kill(**options) def remove_stopped(self, **options): for c in self.containers(stopped=True): if not c.is_running: + log.info("Removing %s..." % c.name) c.remove(**options) def create_container(self, one_off=False, **override_options): @@ -81,12 +85,14 @@ class Service(object): containers = self.containers(stopped=True) if len(containers) == 0: + log.info("Creating %s..." % self.next_container_name()) return ([], [self.create_container(**override_options)]) else: old_containers = [] new_containers = [] for c in containers: + log.info("Recreating %s..." % c.name) (old_container, new_container) = self.recreate_container(c, **override_options) old_containers.append(old_container) new_containers.append(new_container)