Merge pull request #8072 from carlpett/proxmox-handle-interrupt
Check for StateCancelled
This commit is contained in:
commit
2f0968fbbd
|
@ -3,6 +3,7 @@ package proxmox
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Telmate/proxmox-api-go/proxmox"
|
"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 {
|
if rawErr, ok := state.GetOk("error"); ok {
|
||||||
return nil, rawErr.(error)
|
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)
|
tplID, ok := state.Get("template_id").(int)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("template ID could not be determined")
|
return nil, fmt.Errorf("template ID could not be determined")
|
||||||
|
|
Loading…
Reference in New Issue