[lxd] allow passing of publish properties

This commit is contained in:
Chris Lundquist 2017-10-18 04:57:13 +00:00
parent f3c64ce81a
commit c1a7b3845a
2 changed files with 9 additions and 4 deletions

View File

@ -12,10 +12,11 @@ import (
type Config struct {
common.PackerConfig `mapstructure:",squash"`
OutputImage string `mapstructure:"output_image"`
ContainerName string `mapstructure:"container_name"`
CommandWrapper string `mapstructure:"command_wrapper"`
Image string `mapstructure:"image"`
OutputImage string `mapstructure:"output_image"`
ContainerName string `mapstructure:"container_name"`
CommandWrapper string `mapstructure:"command_wrapper"`
Image string `mapstructure:"image"`
PublishProperties map[string]string `mapstructure:"publish_properties"`
InitTimeout time.Duration
ctx interpolate.Context

View File

@ -32,6 +32,10 @@ func (s *stepPublish) Run(state multistep.StateBag) multistep.StepAction {
"publish", name, "--alias", config.OutputImage,
}
for k, v := range config.PublishProperties {
publish_args = append(publish_args, fmt.Sprintf("%s=%s", k, v))
}
ui.Say("Publishing container...")
stdoutString, err := LXDCommand(publish_args...)
if err != nil {