summaryrefslogtreecommitdiffstats
path: root/sources.py
diff options
context:
space:
mode:
authorRadostin Stoyanov <rstoyanov1@gmail.com>2017-04-13 15:06:35 +0100
committerCédric Bosdonnat <cbosdonnat@suse.com>2017-04-14 10:35:10 +0200
commit7343816a5c6de7e54bfa21317239af4380c792b4 (patch)
tree0b481230cbec43ba53ecb1512f68af75884ede53 /sources.py
parent612c5bbb7babe41b463297576710d60ee6188dee (diff)
downloadvirt-bootstrap.git-7343816a5c6de7e54bfa21317239af4380c792b4.tar.gz
virt-bootstrap.git-7343816a5c6de7e54bfa21317239af4380c792b4.tar.xz
virt-bootstrap.git-7343816a5c6de7e54bfa21317239af4380c792b4.zip
Remove trailing slash after docker image
Skopeo does not accept any trailing slash at the end of the url. See https://github.com/projectatomic/skopeo#copying-images.
Diffstat (limited to 'sources.py')
-rw-r--r--sources.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/sources.py b/sources.py
index 7045a29..a7f1eb0 100644
--- a/sources.py
+++ b/sources.py
@@ -55,8 +55,9 @@ class DockerSource:
self.username = username
self.password = password
self.insecure = insecure
- if self.image.startswith('/'):
- self.image = self.image[1:]
+ if self.image and not self.image.startswith('/'):
+ self.image = '/' + self.image
+ self.url = "docker://" + self.registry + self.image
def unpack(self, dest):
tmpDest = tempfile.mkdtemp('virt-bootstrap')
@@ -67,7 +68,7 @@ class DockerSource:
# they should place the certificates in the system
# folders for broader enablement
cmd = ["skopeo", "copy",
- "docker://%s/%s" % (self.registry, self.image),
+ self.url,
"dir:%s" % tmpDest]
if self.insecure:
cmd.append('--src-tls-verify=false')