[lxc-devel] [lxd/master] Image copy bugfixes
stgraber on Github
lxc-bot at linuxcontainers.org
Mon Jul 24 21:54:21 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170724/e89acdbf/attachment.bin>
-------------- next part --------------
From 30b5b94cae745cfe9b8f5a2b34ee250cad64b5ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 24 Jul 2017 17:44:29 -0400
Subject: [PATCH 1/2] lxc: Properly record alias source on copy
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #3586
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxc/image.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lxc/image.go b/lxc/image.go
index fc04a838b..8b214375b 100644
--- a/lxc/image.go
+++ b/lxc/image.go
@@ -410,6 +410,11 @@ func (c *imageCmd) run(conf *config.Config, args []string) error {
imgInfo.Public = true
}
+ if imgInfo.Public && imgInfo.Fingerprint != inName && !strings.HasPrefix(imgInfo.Fingerprint, inName) {
+ // If dealing with an alias, set the imgInfo fingerprint to match
+ imgInfo.Fingerprint = inName
+ }
+
args := lxd.ImageCopyArgs{
AutoUpdate: c.autoUpdate,
Public: c.publicImage,
From f3e334cc6b9c3971f1d8d918587c22e66d79631b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 24 Jul 2017 17:49:57 -0400
Subject: [PATCH 2/2] lxc/utils: Println doesn't do format strings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxc/utils.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lxc/utils.go b/lxc/utils.go
index a43396450..4a8eaa019 100644
--- a/lxc/utils.go
+++ b/lxc/utils.go
@@ -370,7 +370,7 @@ func ensureImageAliases(client lxd.ContainerServer, aliases []api.ImageAlias, fi
for _, alias := range GetExistingAliases(names, resp) {
err := client.DeleteImageAlias(alias.Name)
if err != nil {
- fmt.Println(i18n.G("Failed to remove alias %s"), alias.Name)
+ fmt.Println(fmt.Sprintf(i18n.G("Failed to remove alias %s"), alias.Name))
}
}
// Create new aliases
@@ -380,7 +380,7 @@ func ensureImageAliases(client lxd.ContainerServer, aliases []api.ImageAlias, fi
aliasPost.Target = fingerprint
err := client.CreateImageAlias(aliasPost)
if err != nil {
- fmt.Println(i18n.G("Failed to create alias %s"), alias.Name)
+ fmt.Println(fmt.Sprintf(i18n.G("Failed to create alias %s"), alias.Name))
}
}
return nil
More information about the lxc-devel
mailing list