diff --git a/builder/proxmox/builder.go b/builder/proxmox/builder.go index 089f7aab6..131dfbb48 100644 --- a/builder/proxmox/builder.go +++ b/builder/proxmox/builder.go @@ -3,6 +3,7 @@ package proxmox import ( "context" "crypto/tls" + "errors" "fmt" "github.com/Telmate/proxmox-api-go/proxmox" @@ -89,7 +90,12 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack if rawErr, ok := state.GetOk("error"); ok { return nil, rawErr.(error) } + // If we were interrupted or cancelled, then just exit. + if _, ok := state.GetOk(multistep.StateCancelled); ok { + return nil, errors.New("build was cancelled") + } + // Verify that the template_id was set properly, otherwise we didn't progress through the last step tplID, ok := state.Get("template_id").(int) if !ok { return nil, fmt.Errorf("template ID could not be determined")