Merge pull request #591 from npeters/fix-insecure-registry

fix insecure parameter
This commit is contained in:
Aanand Prasad 2014-11-03 14:17:43 +00:00
commit cb275b8633
2 changed files with 4 additions and 6 deletions

View File

@ -169,10 +169,9 @@ class Project(object):
def up(self, service_names=None, start_links=True, recreate=True, insecure_registry=False):
running_containers = []
for service in self.get_services(service_names, include_links=start_links):
if recreate:
for (_, container) in service.recreate_containers():
for (_, container) in service.recreate_containers(insecure_registry=insecure_registry):
running_containers.append(container)
else:
for container in service.start_or_create_containers(insecure_registry=insecure_registry):

View File

@ -188,16 +188,15 @@ class Service(object):
return Container.create(self.client, **container_options)
raise
def recreate_containers(self, **override_options):
def recreate_containers(self, insecure_registry=False, **override_options):
"""
If a container for this service doesn't exist, create and start one. If there are
any, stop them, create+start new ones, and remove the old containers.
"""
containers = self.containers(stopped=True)
if not containers:
log.info("Creating %s..." % self._next_container_name(containers))
container = self.create_container(**override_options)
container = self.create_container(insecure_registry=insecure_registry, **override_options)
self.start_container(container)
return [(None, container)]
else:
@ -205,7 +204,7 @@ class Service(object):
for c in containers:
log.info("Recreating %s..." % c.name)
tuples.append(self.recreate_container(c, **override_options))
tuples.append(self.recreate_container(c, insecure_registry=insecure_registry, **override_options))
return tuples