Commit 3980c7dc authored by Henry Huang's avatar Henry Huang

Save the spot request before waiting for its active state

parent 1e1fa3de
...@@ -113,7 +113,8 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi ...@@ -113,7 +113,8 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
ui.Error(err.Error()) ui.Error(err.Error())
return multistep.ActionHalt return multistep.ActionHalt
} }
spotRequestId := runSpotResp.SpotRequestResults[0].SpotRequestId s.spotRequest = &runSpotResp.SpotRequestResults[0]
spotRequestId := s.spotRequest.SpotRequestId
ui.Say(fmt.Sprintf("Waiting for spot request (%s) to become ready...", spotRequestId)) ui.Say(fmt.Sprintf("Waiting for spot request (%s) to become ready...", spotRequestId))
stateChange := StateChangeConf{ stateChange := StateChangeConf{
Pending: []string{"open"}, Pending: []string{"open"},
...@@ -135,8 +136,7 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi ...@@ -135,8 +136,7 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
ui.Error(err.Error()) ui.Error(err.Error())
return multistep.ActionHalt return multistep.ActionHalt
} }
s.spotRequest = &spotResp.SpotRequestResults[0] instanceId = []string{spotResp.SpotRequestResults[0].InstanceId}
instanceId = []string{s.spotRequest.InstanceId}
} }
instanceResp, err := ec2conn.Instances(instanceId, nil) instanceResp, err := ec2conn.Instances(instanceId, nil)
......
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