From 9769ffaed7dde37f4dd778d64afb4af8f0c8dfc5 Mon Sep 17 00:00:00 2001 From: Qu Xuan Date: Tue, 9 Apr 2024 17:59:19 +0800 Subject: [PATCH] fix: add amazon linux --- util/imagetools/image_test.go | 16 ++++++++++++++++ util/imagetools/imagetools.go | 3 +++ 2 files changed, 19 insertions(+) diff --git a/util/imagetools/image_test.go b/util/imagetools/image_test.go index d29e06b..c1cc4e5 100644 --- a/util/imagetools/image_test.go +++ b/util/imagetools/image_test.go @@ -109,6 +109,22 @@ func TestNormalizeImageInfo(t *testing.T) { OsLang: "", OsArch: "x86_64", }, + { + Name: "Amazon Linux 2023 AMI", + OsDistro: "Amazon Linux", + OsType: osprofile.OS_TYPE_LINUX, + OsVersion: "2023", + OsLang: "", + OsArch: "x86_64", + }, + { + Name: "Amazon Linux 2 AMI (HVM) - Kernel 5.10, SSD Volume Type", + OsDistro: "Amazon Linux", + OsType: osprofile.OS_TYPE_LINUX, + OsVersion: "2", + OsLang: "", + OsArch: "x86_64", + }, } for _, image := range images { diff --git a/util/imagetools/imagetools.go b/util/imagetools/imagetools.go index b7f38e0..9005821 100644 --- a/util/imagetools/imagetools.go +++ b/util/imagetools/imagetools.go @@ -110,6 +110,8 @@ func normalizeOsDistribution(osDist string, imageName string) string { return "Fedora" } else if strings.Contains(osDist, "alma") { return "AlmaLinux" + } else if strings.Contains(osDist, "amazon linux") { + return "Amazon Linux" } else if strings.Contains(osDist, "windows") { for _, ver := range []string{"2003", "2008", "2012", "2016", "2019", "2022"} { if strings.Contains(osDist, ver) { @@ -144,6 +146,7 @@ var imageVersions = map[string][]string{ "Rocky Linux": {"8.5", "8.6", "8.7", "8.8", "8.9", "9.0", "9.1", "9.2"}, "Fedora": {"33", "34", "35"}, "AlmaLinux": {"8.5"}, + "Amazon Linux": {"2023", "2"}, "Windows Server": {"2003", "2008", "2012", "2016", "2019", "2022"}, "Windows": {"XP", "7", "8", "Vista", "10", "11"},