mirror of
https://github.com/docker/compose.git
synced 2025-07-23 05:34:36 +02:00
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 <chris@w3style.co.uk>
This commit is contained in:
parent
0fc9cc65d1
commit
247691ca44
@ -54,9 +54,6 @@ expose:
|
|||||||
volumes:
|
volumes:
|
||||||
- cache/:/tmp/cache
|
- cache/:/tmp/cache
|
||||||
|
|
||||||
-- Do not automatically run this service on `fig up` (default: true)
|
|
||||||
auto_start: false
|
|
||||||
|
|
||||||
-- Add environment variables.
|
-- Add environment variables.
|
||||||
environment:
|
environment:
|
||||||
RACK_ENV: development
|
RACK_ENV: development
|
||||||
|
@ -92,8 +92,8 @@ class Project(object):
|
|||||||
def get_services(self, service_names=None, include_links=False):
|
def get_services(self, service_names=None, include_links=False):
|
||||||
"""
|
"""
|
||||||
Returns a list of this project's services filtered
|
Returns a list of this project's services filtered
|
||||||
by the provided list of names, or all auto_start services if
|
by the provided list of names, or all services if service_names is None
|
||||||
service_names is None or [].
|
or [].
|
||||||
|
|
||||||
If include_links is specified, returns a list including the links for
|
If include_links is specified, returns a list including the links for
|
||||||
service_names, in order of dependency.
|
service_names, in order of dependency.
|
||||||
@ -105,7 +105,7 @@ class Project(object):
|
|||||||
"""
|
"""
|
||||||
if service_names is None or len(service_names) == 0:
|
if service_names is None or len(service_names) == 0:
|
||||||
return self.get_services(
|
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
|
include_links=include_links
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -45,10 +45,7 @@ class Service(object):
|
|||||||
if 'image' in options and 'build' in options:
|
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)
|
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:
|
supported_options = DOCKER_CONFIG_KEYS + ['build', 'expose']
|
||||||
options['auto_start'] = True
|
|
||||||
|
|
||||||
supported_options = DOCKER_CONFIG_KEYS + ['auto_start', 'build', 'expose']
|
|
||||||
|
|
||||||
for k in options:
|
for k in options:
|
||||||
if k not in supported_options:
|
if k not in supported_options:
|
||||||
|
1
tests/fixtures/simple-figfile/fig.yml
vendored
1
tests/fixtures/simple-figfile/fig.yml
vendored
@ -2,6 +2,5 @@ simple:
|
|||||||
image: busybox:latest
|
image: busybox:latest
|
||||||
command: /bin/sleep 300
|
command: /bin/sleep 300
|
||||||
another:
|
another:
|
||||||
auto_start: false
|
|
||||||
image: busybox:latest
|
image: busybox:latest
|
||||||
command: /bin/sleep 300
|
command: /bin/sleep 300
|
||||||
|
@ -124,17 +124,17 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
project.kill()
|
project.kill()
|
||||||
project.remove_stopped()
|
project.remove_stopped()
|
||||||
|
|
||||||
def test_project_up_without_auto_start(self):
|
def test_project_up_without_all_services(self):
|
||||||
console = self.create_service('console', auto_start=False)
|
console = self.create_service('console')
|
||||||
db = self.create_service('db')
|
db = self.create_service('db')
|
||||||
project = Project('figtest', [console, db], self.client)
|
project = Project('figtest', [console, db], self.client)
|
||||||
project.start()
|
project.start()
|
||||||
self.assertEqual(len(project.containers()), 0)
|
self.assertEqual(len(project.containers()), 0)
|
||||||
|
|
||||||
project.up()
|
project.up()
|
||||||
self.assertEqual(len(project.containers()), 1)
|
self.assertEqual(len(project.containers()), 2)
|
||||||
self.assertEqual(len(db.containers()), 1)
|
self.assertEqual(len(db.containers()), 1)
|
||||||
self.assertEqual(len(console.containers()), 0)
|
self.assertEqual(len(console.containers()), 1)
|
||||||
|
|
||||||
project.kill()
|
project.kill()
|
||||||
project.remove_stopped()
|
project.remove_stopped()
|
||||||
@ -157,7 +157,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
project.kill()
|
project.kill()
|
||||||
project.remove_stopped()
|
project.remove_stopped()
|
||||||
|
|
||||||
def test_project_up_with_no_links(self):
|
def test_project_up_with_no_deps(self):
|
||||||
console = self.create_service('console')
|
console = self.create_service('console')
|
||||||
db = self.create_service('db', volumes=['/var/db'])
|
db = self.create_service('db', volumes=['/var/db'])
|
||||||
web = self.create_service('web', links=[(db, 'db')])
|
web = self.create_service('web', links=[(db, 'db')])
|
||||||
|
@ -68,7 +68,7 @@ class ProjectTest(unittest.TestCase):
|
|||||||
project = Project('test', [web], None)
|
project = Project('test', [web], None)
|
||||||
self.assertEqual(project.get_service('web'), web)
|
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(
|
web = Service(
|
||||||
project='figtest',
|
project='figtest',
|
||||||
name='web',
|
name='web',
|
||||||
@ -76,10 +76,9 @@ class ProjectTest(unittest.TestCase):
|
|||||||
console = Service(
|
console = Service(
|
||||||
project='figtest',
|
project='figtest',
|
||||||
name='console',
|
name='console',
|
||||||
auto_start=False
|
|
||||||
)
|
)
|
||||||
project = Project('test', [web, console], None)
|
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):
|
def test_get_services_returns_listed_services_with_args(self):
|
||||||
web = Service(
|
web = Service(
|
||||||
@ -89,7 +88,6 @@ class ProjectTest(unittest.TestCase):
|
|||||||
console = Service(
|
console = Service(
|
||||||
project='figtest',
|
project='figtest',
|
||||||
name='console',
|
name='console',
|
||||||
auto_start=False
|
|
||||||
)
|
)
|
||||||
project = Project('test', [web, console], None)
|
project = Project('test', [web, console], None)
|
||||||
self.assertEqual(project.get_services(['console']), [console])
|
self.assertEqual(project.get_services(['console']), [console])
|
||||||
|
@ -20,10 +20,6 @@ class ServiceTest(unittest.TestCase):
|
|||||||
Service('a')
|
Service('a')
|
||||||
Service('foo')
|
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):
|
def test_project_validation(self):
|
||||||
self.assertRaises(ConfigError, lambda: Service(name='foo', project='_'))
|
self.assertRaises(ConfigError, lambda: Service(name='foo', project='_'))
|
||||||
Service(name='foo', project='bar')
|
Service(name='foo', project='bar')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user