The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/distrobuilder/pull/262
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === This enables rendering of source keys as well as repository keys. This closed #258. Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
From 6f3be50263eb658a2afa15f1c6d99716f4a4df84 Mon Sep 17 00:00:00 2001 From: Thomas Hipp <thomas.h...@canonical.com> Date: Mon, 18 Nov 2019 09:26:56 +0100 Subject: [PATCH] distrobuilder: Extend pongo2 template usage This enables rendering of source keys as well as repository keys. Signed-off-by: Thomas Hipp <thomas.h...@canonical.com> --- distrobuilder/chroot.go | 6 ++++++ distrobuilder/main.go | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/distrobuilder/chroot.go b/distrobuilder/chroot.go index bd116e7..15ee624 100644 --- a/distrobuilder/chroot.go +++ b/distrobuilder/chroot.go @@ -30,6 +30,12 @@ func manageRepositories(def *shared.Definition, manager *managers.Manager) error return err } + // Run template on repo.Key + repo.Key, err = shared.RenderTemplate(repo.Key, def) + if err != nil { + return err + } + err = manager.RepoHandler(repo) if err != nil { return fmt.Errorf("Error for repository %s: %s", repo.Name, err) diff --git a/distrobuilder/main.go b/distrobuilder/main.go index ba49e72..043d656 100644 --- a/distrobuilder/main.go +++ b/distrobuilder/main.go @@ -236,6 +236,14 @@ func (c *cmdGlobal) preRunBuild(cmd *cobra.Command, args []string) error { return fmt.Errorf("Unsupported source downloader: %s", c.definition.Source.Downloader) } + // Run template on source keys + for i, key := range c.definition.Source.Keys { + c.definition.Source.Keys[i], err = shared.RenderTemplate(key, c.definition) + if err != nil { + return fmt.Errorf("Failed to render source keys: %s", err) + } + } + // Download the root filesystem err = downloader.Run(*c.definition, c.sourceDir) if err != nil {
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel