Allow having a template or a full VM
This commit is contained in:
parent
6af6320f8a
commit
8fe24bddcd
@ -34,6 +34,7 @@ type Config struct {
|
||||
SourcePath string `mapstructure:"source_path"`
|
||||
|
||||
Firmware string `mapstructure:"firmware"`
|
||||
SetTemplate string `mapstructure:"set_template"`
|
||||
|
||||
ctx interpolate.Context
|
||||
}
|
||||
|
@ -109,6 +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"`
|
||||
}
|
||||
|
||||
// FlatMapstructure returns a new FlatConfig.
|
||||
@ -222,6 +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},
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
@ -186,8 +186,7 @@ func (self *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (p
|
||||
Url: self.config.ISOUrls,
|
||||
},
|
||||
}
|
||||
steps := []multistep.Step{
|
||||
&xscommon.StepPrepareOutputDir{
|
||||
steps := []multistep.Step{&xscommon.StepPrepareOutputDir{
|
||||
Force: self.config.PackerForce,
|
||||
Path: self.config.OutputDir,
|
||||
},
|
||||
@ -286,7 +285,14 @@ func (self *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (p
|
||||
},
|
||||
new(commonsteps.StepProvision),
|
||||
new(xscommon.StepShutdown),
|
||||
new(xscommon.StepSetVmToTemplate),
|
||||
}
|
||||
|
||||
if self.config.SetTemplate == "True" {
|
||||
steps = append(steps,
|
||||
new(xscommon.StepSetVmToTemplate))
|
||||
}
|
||||
|
||||
steps = append(steps,
|
||||
&xscommon.StepDetachVdi{
|
||||
VdiUuidKey: "iso_vdi_uuid",
|
||||
},
|
||||
@ -299,8 +305,7 @@ func (self *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (p
|
||||
&xscommon.StepDetachVdi{
|
||||
VdiUuidKey: "floppy_vdi_uuid",
|
||||
},
|
||||
new(xscommon.StepExport),
|
||||
}
|
||||
new(xscommon.StepExport))
|
||||
|
||||
if self.config.ISOName == "" {
|
||||
steps = append(download_steps, steps...)
|
||||
|
Loading…
Reference in New Issue
Block a user