Allow dump generator to add LXC templates

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
Stéphane Graber 2019-01-12 12:52:04 +02:00
parent c3047d252d
commit be0f1011c6
No known key found for this signature in database
GPG Key ID: C638974D64792D67
2 changed files with 11 additions and 1 deletions

View File

@ -15,7 +15,16 @@ type DumpGenerator struct{}
// RunLXC dumps content to a file. // RunLXC dumps content to a file.
func (g DumpGenerator) RunLXC(cacheDir, sourceDir string, img *image.LXCImage, func (g DumpGenerator) RunLXC(cacheDir, sourceDir string, img *image.LXCImage,
defFile shared.DefinitionFile) error { defFile shared.DefinitionFile) error {
return g.Run(cacheDir, sourceDir, defFile) err := g.Run(cacheDir, sourceDir, defFile)
if err != nil {
return err
}
if defFile.Templated {
return img.AddTemplate(defFile.Path)
}
return nil
} }
// RunLXD dumps content to a file. // RunLXD dumps content to a file.

View File

@ -96,6 +96,7 @@ type DefinitionFile struct {
Releases []string `yaml:"releases,omitempty"` Releases []string `yaml:"releases,omitempty"`
Name string `yaml:"name,omitempty"` Name string `yaml:"name,omitempty"`
Template DefinitionFileTemplate `yaml:"template,omitempty"` Template DefinitionFileTemplate `yaml:"template,omitempty"`
Templated bool `yaml:"templated,omitempty"`
} }
// A DefinitionFileTemplate represents the settings used by generators // A DefinitionFileTemplate represents the settings used by generators