Merge pull request #8067 from hashicorp/fix_8043

Fix panic in proxmox builder
This commit is contained in:
Adrien Delorme 2019-09-04 15:10:57 +02:00 committed by GitHub
commit ef9f9fe64a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -90,8 +90,13 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
return nil, rawErr.(error)
}
tplID, ok := state.Get("template_id").(int)
if !ok {
return nil, fmt.Errorf("template ID could not be determined")
}
artifact := &Artifact{
templateID: state.Get("template_id").(int),
templateID: tplID,
proxmoxClient: b.proxmoxClient,
}

View File

@ -3,6 +3,7 @@ package proxmox
import (
"context"
"fmt"
"log"
"github.com/Telmate/proxmox-api-go/proxmox"
"github.com/hashicorp/packer/helper/multistep"
@ -44,7 +45,7 @@ func (s *stepConvertToTemplate) Run(ctx context.Context, state multistep.StateBa
ui.Error(err.Error())
return multistep.ActionHalt
}
log.Printf("template_id: %d", vmRef.VmId())
state.Put("template_id", vmRef.VmId())
return multistep.ActionContinue