From 247691ca4470e685e0f42fb6e455f0b88b04470b Mon Sep 17 00:00:00 2001 From: Chris Corbyn Date: Sat, 21 Jun 2014 10:39:36 +0000 Subject: [PATCH] Remove auto_start option from fig.yml. This option is redundant now that services can be started along with links. Signed-off-by: Chris Corbyn --- docs/yml.md | 3 --- fig/project.py | 6 +++--- fig/service.py | 5 +---- tests/fixtures/simple-figfile/fig.yml | 1 - tests/integration/project_test.py | 10 +++++----- tests/unit/project_test.py | 6 ++---- tests/unit/service_test.py | 4 ---- 7 files changed, 11 insertions(+), 24 deletions(-) diff --git a/docs/yml.md b/docs/yml.md index 8a69dffc7..24484d4f6 100644 --- a/docs/yml.md +++ b/docs/yml.md @@ -54,9 +54,6 @@ expose: volumes: - cache/:/tmp/cache --- Do not automatically run this service on `fig up` (default: true) -auto_start: false - -- Add environment variables. environment: RACK_ENV: development diff --git a/fig/project.py b/fig/project.py index 5e2b1fccb..a3b78f5d5 100644 --- a/fig/project.py +++ b/fig/project.py @@ -92,8 +92,8 @@ class Project(object): def get_services(self, service_names=None, include_links=False): """ Returns a list of this project's services filtered - by the provided list of names, or all auto_start services if - service_names is None or []. + by the provided list of names, or all services if service_names is None + or []. If include_links is specified, returns a list including the links for service_names, in order of dependency. @@ -105,7 +105,7 @@ class Project(object): """ if service_names is None or len(service_names) == 0: return self.get_services( - service_names=[s.name for s in self.services if s.options['auto_start']], + service_names=[s.name for s in self.services], include_links=include_links ) else: diff --git a/fig/service.py b/fig/service.py index 7de0ae7dc..c49f0fd80 100644 --- a/fig/service.py +++ b/fig/service.py @@ -45,10 +45,7 @@ class Service(object): if 'image' in options and 'build' in options: raise ConfigError('Service %s has both an image and build path specified. A service can either be built to image or use an existing image, not both.' % name) - if 'auto_start' not in options: - options['auto_start'] = True - - supported_options = DOCKER_CONFIG_KEYS + ['auto_start', 'build', 'expose'] + supported_options = DOCKER_CONFIG_KEYS + ['build', 'expose'] for k in options: if k not in supported_options: diff --git a/tests/fixtures/simple-figfile/fig.yml b/tests/fixtures/simple-figfile/fig.yml index e301dc622..3538ab097 100644 --- a/tests/fixtures/simple-figfile/fig.yml +++ b/tests/fixtures/simple-figfile/fig.yml @@ -2,6 +2,5 @@ simple: image: busybox:latest command: /bin/sleep 300 another: - auto_start: false image: busybox:latest command: /bin/sleep 300 diff --git a/tests/integration/project_test.py b/tests/integration/project_test.py index dcca570b2..f52476828 100644 --- a/tests/integration/project_test.py +++ b/tests/integration/project_test.py @@ -124,17 +124,17 @@ class ProjectTest(DockerClientTestCase): project.kill() project.remove_stopped() - def test_project_up_without_auto_start(self): - console = self.create_service('console', auto_start=False) + def test_project_up_without_all_services(self): + console = self.create_service('console') db = self.create_service('db') project = Project('figtest', [console, db], self.client) project.start() self.assertEqual(len(project.containers()), 0) project.up() - self.assertEqual(len(project.containers()), 1) + self.assertEqual(len(project.containers()), 2) self.assertEqual(len(db.containers()), 1) - self.assertEqual(len(console.containers()), 0) + self.assertEqual(len(console.containers()), 1) project.kill() project.remove_stopped() @@ -157,7 +157,7 @@ class ProjectTest(DockerClientTestCase): project.kill() project.remove_stopped() - def test_project_up_with_no_links(self): + def test_project_up_with_no_deps(self): console = self.create_service('console') db = self.create_service('db', volumes=['/var/db']) web = self.create_service('web', links=[(db, 'db')]) diff --git a/tests/unit/project_test.py b/tests/unit/project_test.py index 5acd2b4c8..ce80333f2 100644 --- a/tests/unit/project_test.py +++ b/tests/unit/project_test.py @@ -68,7 +68,7 @@ class ProjectTest(unittest.TestCase): project = Project('test', [web], None) self.assertEqual(project.get_service('web'), web) - def test_get_services_returns_all_auto_started_without_args(self): + def test_get_services_returns_all_services_without_args(self): web = Service( project='figtest', name='web', @@ -76,10 +76,9 @@ class ProjectTest(unittest.TestCase): console = Service( project='figtest', name='console', - auto_start=False ) project = Project('test', [web, console], None) - self.assertEqual(project.get_services(), [web]) + self.assertEqual(project.get_services(), [web, console]) def test_get_services_returns_listed_services_with_args(self): web = Service( @@ -89,7 +88,6 @@ class ProjectTest(unittest.TestCase): console = Service( project='figtest', name='console', - auto_start=False ) project = Project('test', [web, console], None) self.assertEqual(project.get_services(['console']), [console]) diff --git a/tests/unit/service_test.py b/tests/unit/service_test.py index 330e04114..490cb60d6 100644 --- a/tests/unit/service_test.py +++ b/tests/unit/service_test.py @@ -20,10 +20,6 @@ class ServiceTest(unittest.TestCase): Service('a') Service('foo') - def test_auto_start_defaults_true(self): - service = Service(name='foo', project='bar') - self.assertEqual(service.options['auto_start'], True) - def test_project_validation(self): self.assertRaises(ConfigError, lambda: Service(name='foo', project='_')) Service(name='foo', project='bar')