Spike: Add 'auto_start' option to fig.yml
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
This commit is contained in:
parent
1b5335f409
commit
8b4ed0c1a8
2 changed files with 12 additions and 5 deletions
|
|
@ -64,7 +64,13 @@ class Project(object):
|
|||
raise ConfigurationError('Service "%s" has a link to service "%s" which does not exist.' % (service_dict['name'], service_name))
|
||||
|
||||
del service_dict['links']
|
||||
project.services.append(Service(client=client, project=name, links=links, **service_dict))
|
||||
|
||||
auto_start = True
|
||||
if 'auto_start' in service_dict:
|
||||
auto_start = service_dict.get('auto_start', True)
|
||||
del service_dict['auto_start']
|
||||
|
||||
project.services.append(Service(auto_start=auto_start, client=client, project=name, links=links, **service_dict))
|
||||
return project
|
||||
|
||||
@classmethod
|
||||
|
|
@ -88,7 +94,7 @@ class Project(object):
|
|||
|
||||
raise NoSuchService(name)
|
||||
|
||||
def get_services(self, service_names=None):
|
||||
def get_services(self, service_names=None, auto_start=True):
|
||||
"""
|
||||
Returns a list of this project's services filtered
|
||||
by the provided list of names, or all services if
|
||||
|
|
@ -100,7 +106,7 @@ class Project(object):
|
|||
do not exist.
|
||||
"""
|
||||
if service_names is None or len(service_names) == 0:
|
||||
return self.services
|
||||
return filter(lambda srv: srv.auto_start == auto_start, self.services)
|
||||
else:
|
||||
unsorted = [self.get_service(name) for name in service_names]
|
||||
return [s for s in self.services if s in unsorted]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue