builder/scaleway: Make use of NewRunnerWithPauseFn

This commit is contained in:
Loïc Carr 2018-01-05 09:57:59 +01:00 committed by Matthew Hooker
parent fc7d89eb79
commit 7f8ed28bc6
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 12 additions and 3 deletions

View File

@ -4,6 +4,7 @@
package scaleway
import (
"errors"
"fmt"
"log"
@ -64,16 +65,24 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
new(stepImage),
}
b.runner = common.NewRunner(steps, b.config.PackerConfig, ui)
b.runner = common.NewRunnerWithPauseFn(steps, b.config.PackerConfig, ui, state)
b.runner.Run(state)
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.")
}
if _, ok := state.GetOk(multistep.StateHalted); ok {
return nil, errors.New("Build was halted.")
}
if _, ok := state.GetOk("snapshot_name"); !ok {
log.Println("Failed to find snapshot_name in state. Bug?")
return nil, nil
return nil, errors.New("Cannot find snapshot_name in state.")
}
artifact := &Artifact{