Merge pull request #8067 from hashicorp/fix_8043
Fix panic in proxmox builder
This commit is contained in:
commit
ef9f9fe64a
|
@ -90,8 +90,13 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
return nil, rawErr.(error)
|
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{
|
artifact := &Artifact{
|
||||||
templateID: state.Get("template_id").(int),
|
templateID: tplID,
|
||||||
proxmoxClient: b.proxmoxClient,
|
proxmoxClient: b.proxmoxClient,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package proxmox
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
|
|
||||||
"github.com/Telmate/proxmox-api-go/proxmox"
|
"github.com/Telmate/proxmox-api-go/proxmox"
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
|
@ -44,7 +45,7 @@ func (s *stepConvertToTemplate) Run(ctx context.Context, state multistep.StateBa
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
|
log.Printf("template_id: %d", vmRef.VmId())
|
||||||
state.Put("template_id", vmRef.VmId())
|
state.Put("template_id", vmRef.VmId())
|
||||||
|
|
||||||
return multistep.ActionContinue
|
return multistep.ActionContinue
|
||||||
|
|
Loading…
Reference in New Issue