Converting to template is now the default behavior + add docs

Signed-off-by: Cécile MORANGE <contact@ataxya.net>
This commit is contained in:
Cécile MORANGE 2023-09-04 18:25:16 +02:00
parent 4438cdce28
commit a9e5f30a55
4 changed files with 7 additions and 4 deletions

View File

@ -34,7 +34,7 @@ type Config struct {
SourcePath string `mapstructure:"source_path"`
Firmware string `mapstructure:"firmware"`
SetTemplate string `mapstructure:"set_template"`
SkipSetTemplate bool `mapstructure:"skip_set_template"`
ctx interpolate.Context
}

View File

@ -109,7 +109,7 @@ type FlatConfig struct {
RawInstallTimeout *string `mapstructure:"install_timeout" cty:"install_timeout" hcl:"install_timeout"`
SourcePath *string `mapstructure:"source_path" cty:"source_path" hcl:"source_path"`
Firmware *string `mapstructure:"firmware" cty:"firmware" hcl:"firmware"`
SetTemplate *string `mapstructure:"set_template" cty:"set_template" hcl:"set_template"`
SkipSetTemplate *bool `mapstructure:"skip_set_template" cty:"skip_set_template" hcl:"skip_set_template"`
}
// FlatMapstructure returns a new FlatConfig.
@ -223,7 +223,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
"install_timeout": &hcldec.AttrSpec{Name: "install_timeout", Type: cty.String, Required: false},
"source_path": &hcldec.AttrSpec{Name: "source_path", Type: cty.String, Required: false},
"firmware": &hcldec.AttrSpec{Name: "firmware", Type: cty.String, Required: false},
"set_template": &hcldec.AttrSpec{Name: "set_template", Type: cty.String, Required: false},
"skip_set_template": &hcldec.AttrSpec{Name: "skip_set_template", Type: cty.Bool, Required: false},
}
return s
}

View File

@ -288,7 +288,7 @@ func (self *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (p
new(xscommon.StepShutdown),
}
if self.config.SetTemplate == "True" {
if !self.config.SkipSetTemplate {
steps = append(steps,
new(xscommon.StepSetVmToTemplate))
}

View File

@ -143,6 +143,9 @@ each category, the available options are alphabetized and described.
regardless of success. "on_success" requests that the VM only be cleaned up if an
artifact was produced. The latter is useful for debugging templates that fail.
* `skip_set_template` (bool) - If you want to get the full XVA, to be able to import directly the VM
instead of using the output template, you can set that to True
* `network_names` (array of strings) - A list of networks identified by their name label which
will be used for the VM during creation. The first network will correspond to the VM's
first network interface (VIF), the second will corespond to the second VIF and so on.