Merge pull request #94 from AtaxyaNetwork/main

Allow user to have a template or a full VM
This commit is contained in:
Dom Del Nano 2023-09-25 20:04:12 -07:00 committed by GitHub
commit 9d57d14f3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 3 deletions

View File

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

View File

@ -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"`
SkipSetTemplate *bool `mapstructure:"skip_set_template" cty:"skip_set_template" hcl:"skip_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},
"skip_set_template": &hcldec.AttrSpec{Name: "skip_set_template", Type: cty.Bool, Required: false},
}
return s
}

View File

@ -286,7 +286,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.SkipSetTemplate {
steps = append(steps,
new(xscommon.StepSetVmToTemplate))
}
steps = append(steps,
&xscommon.StepDetachVdi{
VdiUuidKey: "iso_vdi_uuid",
},
@ -299,8 +306,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...)

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.