Merge pull request #6253 from hashicorp/fix6252

show error message when -on-error=[ask|abort]
This commit is contained in:
Matthew Hooker 2018-05-08 15:31:10 -07:00 committed by GitHub
commit a10172c37c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -71,6 +71,10 @@ func (s abortStep) Run(ctx context.Context, state multistep.StateBag) multistep.
} }
func (s abortStep) Cleanup(state multistep.StateBag) { func (s abortStep) Cleanup(state multistep.StateBag) {
err, ok := state.GetOk("error")
if ok {
s.ui.Error(fmt.Sprintf("%s", err))
}
if _, ok := state.GetOk(multistep.StateCancelled); ok { if _, ok := state.GetOk(multistep.StateCancelled); ok {
s.ui.Error("Interrupted, aborting...") s.ui.Error("Interrupted, aborting...")
os.Exit(1) os.Exit(1)
@ -99,6 +103,11 @@ func (s askStep) Run(ctx context.Context, state multistep.StateBag) (action mult
return return
} }
err, ok := state.GetOk("error")
if ok {
s.ui.Error(fmt.Sprintf("%s", err))
}
switch ask(s.ui, typeName(s.step), state) { switch ask(s.ui, typeName(s.step), state) {
case askCleanup: case askCleanup:
return return

View File

@ -335,7 +335,6 @@ func (c *comm) reconnect() (err error) {
} }
if err != nil { if err != nil {
log.Printf("[ERROR] handshake error: %s", err)
return return
} }
log.Printf("[DEBUG] handshake complete!") log.Printf("[DEBUG] handshake complete!")