Move 'auto_start' option default to Service and add unit tests
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
This commit is contained in:
parent
edf6b56016
commit
0c12db06ec
4 changed files with 12 additions and 11 deletions
|
|
@ -37,7 +37,7 @@ class ConfigError(ValueError):
|
|||
|
||||
|
||||
class Service(object):
|
||||
def __init__(self, name, auto_start=True, client=None, project='default', links=[], **options):
|
||||
def __init__(self, name, client=None, project='default', links=[], **options):
|
||||
if not re.match('^[a-zA-Z0-9]+$', name):
|
||||
raise ConfigError('Invalid name: %s' % name)
|
||||
if not re.match('^[a-zA-Z0-9]+$', project):
|
||||
|
|
@ -45,6 +45,9 @@ 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']
|
||||
|
||||
for k in options:
|
||||
|
|
@ -55,7 +58,6 @@ class Service(object):
|
|||
raise ConfigError(msg)
|
||||
|
||||
self.name = name
|
||||
self.auto_start = auto_start
|
||||
self.client = client
|
||||
self.project = project
|
||||
self.links = links or []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue