The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3565

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Fixed #3562 
From 219a568d492b11bc77a58ce8745f46eaeb7a698c Mon Sep 17 00:00:00 2001
From: Alberto Donato <alberto.don...@canonical.com>
Date: Tue, 18 Jul 2017 15:30:45 +0200
Subject: [PATCH] Fix image refresh when fingerprint is passed.

Signed-off-by: Alberto Donato <alberto.don...@canonical.com>
---
 lxd/images.go | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lxd/images.go b/lxd/images.go
index 9b04cff4b..d764839ad 100644
--- a/lxd/images.go
+++ b/lxd/images.go
@@ -874,7 +874,7 @@ func autoUpdateImages(d *Daemon) {
        for _, fingerprint := range images {
                id, info, err := dbImageGet(d.db, fingerprint, false, true)
                if err != nil {
-                       logger.Error("Error loading image", log.Ctx{"err": err, 
"fp": fingerprint})
+                       logger.Error("Error loading image", log.Ctx{"err": err, 
"fp": info.Fingerprint})
                        continue
                }
 
@@ -882,7 +882,7 @@ func autoUpdateImages(d *Daemon) {
                        continue
                }
 
-               autoUpdateImage(d, nil, fingerprint, id, info)
+               autoUpdateImage(d, nil, id, info)
        }
 
        logger.Infof("Done updating images")
@@ -890,7 +890,8 @@ func autoUpdateImages(d *Daemon) {
 
 // Update a single image.  The operation can be nil, if no progress tracking 
is needed.
 // Returns whether the image has been updated.
-func autoUpdateImage(d *Daemon, op *operation, fingerprint string, id int, 
info *api.Image) error {
+func autoUpdateImage(d *Daemon, op *operation, id int, info *api.Image) error {
+       fingerprint := info.Fingerprint
        _, source, err := dbImageSourceGet(d.db, id)
        if err != nil {
                logger.Error("Error getting source image", log.Ctx{"err": err, 
"fp": fingerprint})
@@ -1601,7 +1602,7 @@ func imageRefresh(d *Daemon, r *http.Request) Response {
 
        // Begin background operation
        run := func(op *operation) error {
-               return autoUpdateImage(d, op, fingerprint, imageId, imageInfo)
+               return autoUpdateImage(d, op, imageId, imageInfo)
        }
 
        op, err := operationCreate(operationClassTask, nil, nil, run, nil, nil)
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to