builder/amazon: clean up UI output for spot instances a bit

This commit is contained in:
Mitchell Hashimoto 2014-09-05 16:58:17 -07:00
parent 2e5f3da5c1
commit 7d1db44ca4
2 changed files with 7 additions and 2 deletions

View File

@ -93,6 +93,10 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
}
instanceId = []string{runResp.Instances[0].InstanceId}
} else {
ui.Message(fmt.Sprintf(
"Requesting spot instance '%s' for: %s",
s.InstanceType, s.SpotPrice))
runOpts := &ec2.RequestSpotInstances{
SpotPrice: s.SpotPrice,
KeyName: keyName,
@ -113,9 +117,11 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
ui.Error(err.Error())
return multistep.ActionHalt
}
s.spotRequest = &runSpotResp.SpotRequestResults[0]
spotRequestId := s.spotRequest.SpotRequestId
ui.Say(fmt.Sprintf("Waiting for spot request (%s) to become ready...", spotRequestId))
ui.Message(fmt.Sprintf("Waiting for spot request (%s) to become active...", spotRequestId))
stateChange := StateChangeConf{
Pending: []string{"open"},
Target: "active",

View File

@ -19,7 +19,6 @@ func (s *stepStopInstance) Run(state multistep.StateBag) multistep.StepAction {
// Skip when it is a spot instance
if s.SpotPrice != "" {
ui.Say(fmt.Sprintf("This is a spot instance, no need to stop for the AMI"))
return multistep.ActionContinue
}