[lxc-devel] [distrobuilder/master] source: Provide fallback URL for openSUSE

monstermunchkin on Github lxc-bot at linuxcontainers.org
Tue Jul 23 16:13:10 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190723/871c6b21/attachment-0001.bin>
-------------- next part --------------
From 8c741e985d332b050054fa2e1637fcd0a62ed603 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Tue, 23 Jul 2019 18:10:56 +0200
Subject: [PATCH] source: Provide fallback URL for openSUSE

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 sources/opensuse-http.go | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sources/opensuse-http.go b/sources/opensuse-http.go
index 0889ef2..9d7b224 100644
--- a/sources/opensuse-http.go
+++ b/sources/opensuse-http.go
@@ -33,9 +33,20 @@ func (s *OpenSUSEHTTP) Run(definition shared.Definition, rootfsDir string) error
 	var baseURL string
 	var fname string
 
+	useCustomURL := true
+
+	if definition.Source.URL == "" {
+		definition.Source.URL = "https://download.opensuse.org"
+		useCustomURL = false
+	}
+
 	tarballPath := s.getPathToTarball(definition.Source.URL, definition.Image.Release,
 		definition.Image.ArchitectureMapped)
 
+	if !useCustomURL {
+		tarballPath = strings.Replace(tarballPath, "download", "downloadcontent", 1)
+	}
+
 	resp, err := http.Head(tarballPath)
 	if err != nil {
 		return fmt.Errorf("Couldn't resolve URL: %v", err)


More information about the lxc-devel mailing list