builder/amazon: fix crash case if SIGINT while waiting for instance

This commit is contained in:
Mitchell Hashimoto 2013-08-17 09:45:23 -06:00
parent 775555944e
commit 6ef73b88be
1 changed files with 1 additions and 1 deletions

View File

@ -92,7 +92,6 @@ func (s *StepRunSourceInstance) Run(state map[string]interface{}) multistep.Step
StepState: state,
}
latestInstance, err := WaitForState(&stateChange)
s.instance = latestInstance.(*ec2.Instance)
if err != nil {
err := fmt.Errorf("Error waiting for instance (%s) to become ready: %s", s.instance.InstanceId, err)
state["error"] = err
@ -100,6 +99,7 @@ func (s *StepRunSourceInstance) Run(state map[string]interface{}) multistep.Step
return multistep.ActionHalt
}
s.instance = latestInstance.(*ec2.Instance)
state["instance"] = s.instance
return multistep.ActionContinue