Skip to content

Commit

Permalink
Add support for specifying flags when importing an OVF template into …
Browse files Browse the repository at this point in the history
…a content library (#189)
  • Loading branch information
hmalphettes authored Jun 29, 2022
1 parent 9500011 commit ed96cf2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
5 changes: 4 additions & 1 deletion builder/vsphere/common/step_import_to_content_library.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ type ContentLibraryDestinationConfig struct {
Ovf bool `mapstructure:"ovf"`
// When set to true, the VM won't be imported to the content library item. Useful for setting to `true` during a build test stage. Defaults to `false`.
SkipImport bool `mapstructure:"skip_import"`
// Flags to use for OVF package creation. The supported flags can be obtained using ExportFlag.list. If unset, no flags will be used. Known values: EXTRA_CONFIG, PRESERVE_MAC
OvfFlags []string `mapstructure:"ovf_flags"`
}

func (c *ContentLibraryDestinationConfig) Prepare(lc *LocationConfig) []error {
Expand Down Expand Up @@ -167,7 +169,8 @@ func (s *StepImportToContentLibrary) Run(_ context.Context, state multistep.Stat
func (s *StepImportToContentLibrary) importOvfTemplate(vm *driver.VirtualMachineDriver) error {
ovf := vcenter.OVF{
Spec: vcenter.CreateSpec{
Name: s.ContentLibConfig.Name,
Name: s.ContentLibConfig.Name,
Flags: s.ContentLibConfig.OvfFlags,
},
Target: vcenter.LibraryTarget{
LibraryID: s.ContentLibConfig.Library,
Expand Down
24 changes: 13 additions & 11 deletions builder/vsphere/common/step_import_to_content_library.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@

- `skip_import` (bool) - When set to true, the VM won't be imported to the content library item. Useful for setting to `true` during a build test stage. Defaults to `false`.

- `ovf_flags` ([]string) - Flags to use for OVF package creation. The supported flags can be obtained using ExportFlag.list. If unset, no flags will be used. Known values: EXTRA_CONFIG, PRESERVE_MAC

<!-- End of code generated from the comments of the ContentLibraryDestinationConfig struct in builder/vsphere/common/step_import_to_content_library.go; -->

0 comments on commit ed96cf2

Please sign in to comment.