Raise error in case of create server failure

This commit is contained in:
Edouard BONLIEU 2017-07-11 16:15:00 +02:00 committed by Matthew Hooker
parent 520433c0b8
commit b44798b38d
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 9 additions and 2 deletions

View File

@ -34,10 +34,17 @@ func (s *stepCreateServer) Run(state multistep.StateBag) multistep.StepAction {
Tags: tags,
})
if err != nil {
err := fmt.Errorf("Error creating server: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
}
err = client.PostServerAction(server, "poweron")
if err != nil {
err := fmt.Errorf("Error creating server: %s", err)
err := fmt.Errorf("Error starting server: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
@ -51,7 +58,7 @@ func (s *stepCreateServer) Run(state multistep.StateBag) multistep.StepAction {
}
func (s *stepCreateServer) Cleanup(state multistep.StateBag) {
if s.serverID != "" {
if s.serverID == "" {
return
}