[lxc-devel] [lxd/master] images: Record the server certificate in the cache

stgraber on Github lxc-bot at linuxcontainers.org
Thu Mar 9 23:28:48 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170309/527389fc/attachment.bin>
-------------- next part --------------
From a8362981e87bbe58e101ffbe02f5884d61669af8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 9 Mar 2017 18:06:10 -0500
Subject: [PATCH] images: Record the server certificate in the cache
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>
---
 lxd/daemon_images.go | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lxd/daemon_images.go b/lxd/daemon_images.go
index 9e9d164..f55559e 100644
--- a/lxd/daemon_images.go
+++ b/lxd/daemon_images.go
@@ -26,6 +26,7 @@ import (
 // Simplestream cache
 type imageStreamCacheEntry struct {
 	Aliases      []api.ImageAliasesEntry `yaml:"aliases"`
+	Certificate  string                  `yaml:"certificate"`
 	Fingerprints []string                `yaml:"fingerprints"`
 	expiry       time.Time
 	ss           *simplestreams.SimpleStreams
@@ -71,7 +72,7 @@ func imageLoadStreamCache(d *Daemon) error {
 
 	for url, entry := range imageStreamCache {
 		if entry.ss == nil {
-			myhttp, err := d.httpClient("")
+			myhttp, err := d.httpClient(entry.Certificate)
 			if err != nil {
 				return err
 			}
@@ -129,7 +130,7 @@ func (d *Daemon) ImageDownload(op *operation, server string, protocol string, ce
 				}
 
 				// Generate cache entry
-				entry = &imageStreamCacheEntry{ss: ss, Aliases: aliases, Fingerprints: fingerprints, expiry: time.Now().Add(time.Hour)}
+				entry = &imageStreamCacheEntry{ss: ss, Aliases: aliases, Certificate: certificate, Fingerprints: fingerprints, expiry: time.Now().Add(time.Hour)}
 				imageStreamCache[server] = entry
 				imageSaveStreamCache()
 


More information about the lxc-devel mailing list