From 35ba405817a6114a78f3c6b6e7ee393afabe9f83 Mon Sep 17 00:00:00 2001 From: peusterm Date: Mon, 2 May 2016 21:21:14 +0200 Subject: [PATCH] first version of docker pull functionality --- src/emuvim/api/sonata/dummygatekeeper.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/emuvim/api/sonata/dummygatekeeper.py b/src/emuvim/api/sonata/dummygatekeeper.py index 58c9182..0767b7b 100644 --- a/src/emuvim/api/sonata/dummygatekeeper.py +++ b/src/emuvim/api/sonata/dummygatekeeper.py @@ -212,8 +212,11 @@ class Service(object): for k, v in self.vnfds.iteritems(): for vu in v.get("virtual_deployment_units"): if vu.get("vm_image_format") == "docker": - self.remote_docker_image_urls[k] = vu.get("vm_image") - LOG.debug("Found Docker image URL: %r" % self.remote_docker_image_urls[k]) + url = vu.get("vm_image") + if url is not None: + url = url.replace("http://", "") + self.remote_docker_image_urls[k] = url + LOG.debug("Found Docker image URL: %r" % self.remote_docker_image_urls[k]) def _build_images_from_dockerfiles(self): """ @@ -233,7 +236,11 @@ class Service(object): If the package contains URLs to pre-build Docker images, we download them with this method. """ # TODO implement this - pass + dc = DockerClient() + for url in self.remote_docker_image_urls.itervalues(): + LOG.info("Pulling image: %r" % url) + dc.pull(url, + insecure_registry=True) def _check_docker_image_exists(self, image_name): """ -- 2.25.1