浏览代码

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 <[email protected]>
Chris Corbyn 11 年之前
父节点
当前提交
247691ca44

+ 0 - 3
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

+ 3 - 3
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:

+ 1 - 4
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:

+ 0 - 1
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

+ 5 - 5
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')])

+ 2 - 4
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])

+ 0 - 4
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')