[lxc-devel] [distrobuilder/master] Handle multiple available CentOS images
monstermunchkin on Github
lxc-bot at linuxcontainers.org
Mon Aug 3 16:08:03 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 310 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200803/162b0c5b/attachment.bin>
-------------- next part --------------
From 8b158a6a20e9bff2a33bd18594e4d07f52d04229 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Mon, 3 Aug 2020 18:06:51 +0200
Subject: [PATCH 1/2] sources/centos: Handle list of multiple images
Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
sources/centos-http.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sources/centos-http.go b/sources/centos-http.go
index 922378e..e580c92 100644
--- a/sources/centos-http.go
+++ b/sources/centos-http.go
@@ -407,9 +407,9 @@ func (s CentOSHTTP) getRelease(URL, release, variant, arch string) string {
}
for _, r := range re {
- match := regexp.MustCompile(r).FindString(string(body))
- if match != "" {
- return match
+ matches := regexp.MustCompile(r).FindAllString(string(body), -1)
+ if len(matches) > 0 {
+ return matches[len(matches)-1]
}
}
From 8ff8ee0243af178a07c7b1385c99539c5c67fccc Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Mon, 3 Aug 2020 18:07:14 +0200
Subject: [PATCH 2/2] sources: Fix apertis test
Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
sources/apertis-http_test.go | 4 ----
1 file changed, 4 deletions(-)
diff --git a/sources/apertis-http_test.go b/sources/apertis-http_test.go
index aa899dc..cd2d0d1 100644
--- a/sources/apertis-http_test.go
+++ b/sources/apertis-http_test.go
@@ -26,10 +26,6 @@ func TestApertisHTTP_getLatestRelease(t *testing.T) {
"18.12",
"18.12.0",
},
- {
- "v2019pre",
- "v2019pre.0",
- },
}
for _, tt := range tests {
baseURL := fmt.Sprintf("https://images.apertis.org/release/%s", tt.release)
More information about the lxc-devel
mailing list