[lxc-devel] [distrobuilder/master] Added missing definitions in generators hosts, hostname
getopendroplet on Github
lxc-bot at linuxcontainers.org
Thu Nov 12 17:07:55 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 411 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201112/8185fb18/attachment.bin>
-------------- next part --------------
From 519d77577ead7cd3023b58b02d09a9784b357543 Mon Sep 17 00:00:00 2001
From: Get OpenDroplet <getopendroplet at gmail.com>
Date: Thu, 12 Nov 2020 18:58:11 +0200
Subject: [PATCH] Added missing definitions in generators hosts, hostname
Signed-off-by: Get OpenDroplet <getopendroplet at gmail.com>
---
generators/hostname.go | 11 ++++++++---
generators/hosts.go | 11 ++++++++---
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/generators/hostname.go b/generators/hostname.go
index 136609c..7bf07f5 100644
--- a/generators/hostname.go
+++ b/generators/hostname.go
@@ -70,11 +70,16 @@ func (g HostnameGenerator) RunLXD(cacheDir, sourceDir string, img *image.LXDImag
// Add to LXD templates
img.Metadata.Templates[defFile.Path] = &api.ImageMetadataTemplate{
- Template: "hostname.tpl",
- When: []string{
+ Template: "hostname.tpl",
+ Properties: defFile.Template.Properties,
+ When: defFile.Template.When,
+ }
+
+ if len(defFile.Template.When) == 0 {
+ img.Metadata.Templates[defFile.Path].When = []string{
"create",
"copy",
- },
+ }
}
return err
diff --git a/generators/hosts.go b/generators/hosts.go
index b4ac000..4e41e88 100644
--- a/generators/hosts.go
+++ b/generators/hosts.go
@@ -92,11 +92,16 @@ func (g HostsGenerator) RunLXD(cacheDir, sourceDir string, img *image.LXDImage,
}
img.Metadata.Templates[defFile.Path] = &api.ImageMetadataTemplate{
- Template: "hosts.tpl",
- When: []string{
+ Template: "hosts.tpl",
+ Properties: defFile.Template.Properties,
+ When: defFile.Template.When,
+ }
+
+ if len(defFile.Template.When) == 0 {
+ img.Metadata.Templates[defFile.Path].When = []string{
"create",
"copy",
- },
+ }
}
return err
More information about the lxc-devel
mailing list