Services can join 'bridge' or 'host'

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2016-01-14 13:16:02 +00:00
commit ca68c9faa4
3 changed files with 45 additions and 6 deletions

View file

@ -172,13 +172,16 @@ class Project(object):
def get_networks(self, service_dict, network_definitions):
networks = []
for name in service_dict.pop('networks', ['default']):
matches = [n for n in network_definitions if n.name == name]
if matches:
networks.append(matches[0].full_name)
if name in ['bridge', 'host']:
networks.append(name)
else:
raise ConfigurationError(
'Service "{}" uses an undefined network "{}"'
.format(service_dict['name'], name))
matches = [n for n in network_definitions if n.name == name]
if matches:
networks.append(matches[0].full_name)
else:
raise ConfigurationError(
'Service "{}" uses an undefined network "{}"'
.format(service_dict['name'], name))
return networks
def get_links(self, service_dict):