From e46914067890c3c0528f8c4e6f028bfeb7b79698 Mon Sep 17 00:00:00 2001 From: Tommy McNeely Date: Tue, 7 Jan 2020 16:52:13 -0700 Subject: [PATCH] workaround for mapstructure-to-hcl2 and booleans --- post-processor/vsphere-template/post-processor.go | 2 +- post-processor/vsphere-template/post-processor.hcl2spec.go | 2 +- post-processor/vsphere-template/step_mark_as_template.go | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/post-processor/vsphere-template/post-processor.go b/post-processor/vsphere-template/post-processor.go index 4367c9832..59ce16a77 100644 --- a/post-processor/vsphere-template/post-processor.go +++ b/post-processor/vsphere-template/post-processor.go @@ -37,7 +37,7 @@ type Config struct { SnapshotEnable bool `mapstructure:"snapshot_enable"` SnapshotName string `mapstructure:"snapshot_name"` SnapshotDescription string `mapstructure:"snapshot_description"` - ReregisterVM bool `mapstructure:"reregister_vm" default:true` + ReregisterVM bool `mapstructure:"reregister_vm" default:"true"` ctx interpolate.Context } diff --git a/post-processor/vsphere-template/post-processor.hcl2spec.go b/post-processor/vsphere-template/post-processor.hcl2spec.go index 10896c626..f58baf089 100644 --- a/post-processor/vsphere-template/post-processor.hcl2spec.go +++ b/post-processor/vsphere-template/post-processor.hcl2spec.go @@ -25,7 +25,7 @@ type FlatConfig struct { SnapshotEnable *bool `mapstructure:"snapshot_enable" cty:"snapshot_enable"` SnapshotName *string `mapstructure:"snapshot_name" cty:"snapshot_name"` SnapshotDescription *string `mapstructure:"snapshot_description" cty:"snapshot_description"` - ReregisterVM *bool `mapstructure:"reregister_vm" cty:"reregister_vm"` + ReregisterVM *bool `mapstructure:"reregister_vm" default:"true" cty:"reregister_vm"` } // FlatMapstructure returns a new FlatConfig. diff --git a/post-processor/vsphere-template/step_mark_as_template.go b/post-processor/vsphere-template/step_mark_as_template.go index 369988c12..d1f5d12af 100644 --- a/post-processor/vsphere-template/step_mark_as_template.go +++ b/post-processor/vsphere-template/step_mark_as_template.go @@ -44,7 +44,6 @@ func (s *stepMarkAsTemplate) Run(ctx context.Context, state multistep.StateBag) folder := state.Get("folder").(*object.Folder) dcPath := state.Get("dcPath").(string) - vm, err := findRuntimeVM(cli, dcPath, s.VMName, s.RemoteFolder) if err != nil { state.Put("error", err)