[lxc-devel] [distrobuilder/master] Update hostname.go
whatagraph-evaldas on Github
lxc-bot at linuxcontainers.org
Sun Nov 8 15:22:58 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/20201108/5bfe5332/attachment.bin>
-------------- next part --------------
From 0ee72fbdc8b0c8031c366fa23c51442cf7888374 Mon Sep 17 00:00:00 2001
From: whatagraph-evaldas
<72733353+whatagraph-evaldas at users.noreply.github.com>
Date: Sun, 8 Nov 2020 17:22:25 +0200
Subject: [PATCH] Update hostname.go
---
generators/hostname.go | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/generators/hostname.go b/generators/hostname.go
index 136609c..999e3c3 100644
--- a/generators/hostname.go
+++ b/generators/hostname.go
@@ -71,10 +71,15 @@ 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{
+ 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