[lxc-devel] [lxd/master] lxc/image: Fix import from URL

stgraber on Github lxc-bot at linuxcontainers.org
Fri Mar 23 20:08:04 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180323/a5923714/attachment.bin>
-------------- next part --------------
From f7e22256bd41f96b5dddba4c529c40206a0632bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 23 Mar 2018 16:07:28 -0400
Subject: [PATCH] lxc/image: Fix import from URL
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #4553

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxc/image.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lxc/image.go b/lxc/image.go
index 595ee72dc..1b76cd48e 100644
--- a/lxc/image.go
+++ b/lxc/image.go
@@ -678,7 +678,10 @@ func (c *imageCmd) run(conf *config.Config, args []string) error {
 			imageFile = args[1]
 			properties = properties[1:]
 		}
-		imageFile = shared.HostPath(filepath.Clean(imageFile))
+
+		if shared.PathExists(shared.HostPath(filepath.Clean(imageFile))) {
+			imageFile = shared.HostPath(filepath.Clean(imageFile))
+		}
 
 		d, err := conf.GetContainerServer(remote)
 		if err != nil {


More information about the lxc-devel mailing list