diff --git a/builder/ankavm/step_create_vm.go b/builder/ankavm/step_create_vm.go index d70d7af2..ab01782f 100644 --- a/builder/ankavm/step_create_vm.go +++ b/builder/ankavm/step_create_vm.go @@ -123,7 +123,7 @@ func (s *StepCreateVM) modifyVMProperties(describeResponse client.DescribeRespon return err } err := s.client.Modify(showResponse.Name, "add", "port-forwarding", "--host-port", strconv.Itoa(wantedPortForwardingRule.PortForwardingHostPort), "--guest-port", strconv.Itoa(wantedPortForwardingRule.PortForwardingGuestPort), wantedPortForwardingRule.PortForwardingRuleName) - if !config.PackerConfig.PackerForce { // If force is enabled, just skip + if !config.PackerForce { // If force is enabled, just skip if err != nil { return err } @@ -248,7 +248,7 @@ func (s *StepCreateVM) Run(ctx context.Context, state multistep.StateBag) multis // If the user forces the build (packer build --force), delete the existing VM that would fail the build exists, err := s.client.Exists(clonedVMName) - if exists && config.PackerConfig.PackerForce { + if exists && config.PackerForce { ui.Say(fmt.Sprintf("Deleting existing virtual machine %s", clonedVMName)) if err = s.client.Delete(client.DeleteParams{VMName: clonedVMName}); err != nil { return onError(err) diff --git a/post-processor/ankaregistry/post-processor.go b/post-processor/ankaregistry/post-processor.go index 24abab2e..4bb5922d 100644 --- a/post-processor/ankaregistry/post-processor.go +++ b/post-processor/ankaregistry/post-processor.go @@ -16,7 +16,7 @@ import ( "github.com/veertuinc/packer-builder-veertu-anka/client" ) -const BuilderIdImport = "packer.post-processor.veertu-anka-registry" +const BuilderIdRegistry = "packer.post-processor.veertu-anka-registry" type Config struct { common.PackerConfig `mapstructure:",squash"` @@ -44,6 +44,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap func (p *PostProcessor) Configure(raws ...interface{}) error { err := config.Decode(&p.config, &config.DecodeOpts{ + PluginType: BuilderIdRegistry, Interpolate: true, InterpolateContext: &p.config.ctx, InterpolateFilter: &interpolate.RenderFilter{ @@ -91,7 +92,7 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact } // If force is true, revert the template tag (if one exists) on the registry so we can push the VM without issue - if p.config.PackerConfig.PackerForce { + if p.config.PackerForce { var id string templates, err := ankaClient.RegistryList(registryParams)