Commit b6d6a71c authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/openstack: wait for more states

parent 48b674d3
......@@ -28,7 +28,7 @@ type StateChangeConf struct {
Pending []string
Refresh StateRefreshFunc
StepState multistep.StateBag
Target string
Target []string
}
// ServerStateRefreshFunc returns a StateRefreshFunc that is used to watch
......@@ -65,8 +65,10 @@ func WaitForState(conf *StateChangeConf) (i interface{}, err error) {
return
}
if currentState == conf.Target {
return
for _, t := range conf.Target {
if currentState == t {
return
}
}
if conf.StepState != nil {
......
......@@ -65,7 +65,7 @@ func (s *StepRunSourceServer) Run(state multistep.StateBag) multistep.StepAction
ui.Say("Waiting for server to become ready...")
stateChange := StateChangeConf{
Pending: []string{"BUILD"},
Target: "ACTIVE",
Target: []string{"ACTIVE"},
Refresh: ServerStateRefreshFunc(computeClient, s.server),
StepState: state,
}
......@@ -105,9 +105,9 @@ func (s *StepRunSourceServer) Cleanup(state multistep.StateBag) {
}
stateChange := StateChangeConf{
Pending: []string{"ACTIVE", "BUILD", "REBUILD", "SUSPENDED"},
Pending: []string{"ACTIVE", "BUILD", "REBUILD", "SUSPENDED", "SHUTOFF", "STOPPED"},
Refresh: ServerStateRefreshFunc(computeClient, s.server),
Target: "DELETED",
Target: []string{"DELETED"},
}
WaitForState(&stateChange)
......
......@@ -41,7 +41,7 @@ func (s *StepStopServer) Run(state multistep.StateBag) multistep.StepAction {
ui.Message("Waiting for server to stop...")
stateChange := StateChangeConf{
Pending: []string{"ACTIVE"},
Target: "STOPPED",
Target: []string{"SHUTOFF", "STOPPED"},
Refresh: ServerStateRefreshFunc(client, server),
StepState: state,
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment