[lxc-devel] [distrobuilder/master] shared: do not require release field

monstermunchkin on Github lxc-bot at linuxcontainers.org
Wed Feb 14 09:49:21 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 378 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180214/ca1e02a5/attachment.bin>
-------------- next part --------------
From b64123b426b7ab6b59a77f709940de43dee40b23 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Wed, 14 Feb 2018 10:35:03 +0100
Subject: [PATCH] shared: do not require release field

Resolves #4.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 shared/definition.go      |  6 +-----
 shared/definition_test.go | 10 ----------
 2 files changed, 1 insertion(+), 15 deletions(-)

diff --git a/shared/definition.go b/shared/definition.go
index d2f4c14..ecf5029 100644
--- a/shared/definition.go
+++ b/shared/definition.go
@@ -22,7 +22,7 @@ type DefinitionPackages struct {
 type DefinitionImage struct {
 	Description  string `yaml:"description"`
 	Distribution string `yaml:"distribution"`
-	Release      string `yaml:"release"`
+	Release      string `yaml:"release,omitempty"`
 	Arch         string `yaml:"arch,omitempty"`
 	Expiry       string `yaml:"expiry,omitempty"`
 	Variant      string `yaml:"variant,omitempty"`
@@ -99,10 +99,6 @@ func ValidateDefinition(def Definition) error {
 		return errors.New("image.distribution may not be empty")
 	}
 
-	if strings.TrimSpace(def.Image.Release) == "" {
-		return errors.New("image.release may not be empty")
-	}
-
 	validDownloaders := []string{
 		"alpinelinux-http",
 		"archlinux-http",
diff --git a/shared/definition_test.go b/shared/definition_test.go
index e2e64f6..63332bf 100644
--- a/shared/definition_test.go
+++ b/shared/definition_test.go
@@ -52,16 +52,6 @@ func TestValidateDefinition(t *testing.T) {
 			"image.distribution may not be empty",
 			true,
 		},
-		{
-			"empty image.release",
-			Definition{
-				Image: DefinitionImage{
-					Distribution: "ubuntu",
-				},
-			},
-			"image.release may not be empty",
-			true,
-		},
 		{
 			"invalid source.downloader",
 			Definition{


More information about the lxc-devel mailing list