Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: hashicorp/packer-plugin-vsphere
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f7d9bd5cb0c996a7633fbcbf31d84764d0c8255a
Choose a base ref
..
head repository: hashicorp/packer-plugin-vsphere
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 81d2fb7b48c3b19e78c9a7a08280559491111ffb
Choose a head ref
Showing with 8 additions and 8 deletions.
  1. +1 −1 post-processor/vsphere-template/post-processor.go
  2. +7 −7 post-processor/vsphere-template/step_mark_as_template.go
2 changes: 1 addition & 1 deletion post-processor/vsphere-template/post-processor.go
Original file line number Diff line number Diff line change
@@ -125,7 +125,7 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifa
// Check if the artifact is supported by the post-processor.
if _, ok := builtins[artifact.BuilderId()]; !ok {
return nil, false, false, fmt.Errorf(
"error: unsupported artifact type %s. supported types: vmware-iso (ESXi) or vSphere post-processor", artifact.BuilderId())
"error: unsupported artifact type %s. supported types: vsphere-iso exported OVF or vSphere post-processor", artifact.BuilderId())
}

f := artifact.State(ArtifactConfFormat)
14 changes: 7 additions & 7 deletions post-processor/vsphere-template/step_mark_as_template.go
Original file line number Diff line number Diff line change
@@ -43,10 +43,6 @@ func NewStepMarkAsTemplate(artifact packersdk.Artifact, p *PostProcessor) *stepM
vmname = id[2]
}

if p.config.TemplateName != "" {
vmname = p.config.TemplateName
}

return &stepMarkAsTemplate{
VMName: vmname,
TemplateName: p.config.TemplateName,
@@ -80,8 +76,6 @@ func (s *stepMarkAsTemplate) Run(ctx context.Context, state multistep.StateBag)
return multistep.ActionContinue
}

ui.Message("Registering virtual machine as a template...")

dsPath, err := datastorePath(vm)
if err != nil {
state.Put("error", err)
@@ -108,7 +102,13 @@ func (s *stepMarkAsTemplate) Run(ctx context.Context, state multistep.StateBag)
return multistep.ActionHalt
}

task, err := folder.RegisterVM(context.Background(), dsPath.String(), s.VMName, true, nil, host)
artifactName := s.VMName
if s.TemplateName != "" {
artifactName = s.TemplateName
}
ui.Message("Registering virtual machine as a template: " + artifactName)

task, err := folder.RegisterVM(context.Background(), dsPath.String(), artifactName, true, nil, host)
if err != nil {
state.Put("error", err)
ui.Error("RegisterVM:" + err.Error())