Make external_links a regular service.option so that it's part of the config hash

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
Daniel Nephin 2015-09-01 18:56:40 -04:00
parent 2073805bc1
commit ef56523883
1 changed files with 11 additions and 3 deletions

View File

@ -87,7 +87,16 @@ ConvergencePlan = namedtuple('ConvergencePlan', 'action containers')
class Service(object):
def __init__(self, name, client=None, project='default', links=None, external_links=None, volumes_from=None, net=None, **options):
def __init__(
self,
name,
client=None,
project='default',
links=None,
volumes_from=None,
net=None,
**options
):
if not re.match('^%s+$' % VALID_NAME_CHARS, project):
raise ConfigError('Invalid project name "%s" - only %s are allowed' % (project, VALID_NAME_CHARS))
@ -95,7 +104,6 @@ class Service(object):
self.client = client
self.project = project
self.links = links or []
self.external_links = external_links or []
self.volumes_from = volumes_from or []
self.net = net or None
self.options = options
@ -528,7 +536,7 @@ class Service(object):
links.append((container.name, self.name))
links.append((container.name, container.name))
links.append((container.name, container.name_without_project))
for external_link in self.external_links:
for external_link in self.options.get('external_links') or []:
if ':' not in external_link:
link_name = external_link
else: