@ -195,21 +195,13 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
instanceId = spotResp . SpotRequestResults [ 0 ] . InstanceId
}
instanceResp , err := ec2conn . Instances ( [ ] string { instanceId } , nil )
if err != nil {
err := fmt . Errorf ( "Error finding source instance (%s): %s" , instanceId , err )
state . Put ( "error" , err )
ui . Error ( err . Error ( ) )
return multistep . ActionHalt
}
s . instance = & instanceResp . Reservations [ 0 ] . Instances [ 0 ]
ui . Message ( fmt . Sprintf ( "Instance ID: %s" , s . instance . InstanceId ) )
ui . Message ( fmt . Sprintf ( "Instance ID: %s" , instanceId ) )
ui . Say ( fmt . Sprintf ( "Waiting for instance (% s) to become ready...", s . instance . I nstanceId) )
ui . Say ( fmt . Sprintf ( "Waiting for instance (%v) to become ready..." , instanceId ) )
stateChange := StateChangeConf {
Pending : [ ] string { "pending" } ,
Target : "running" ,
Refresh : InstanceStateRefreshFunc ( ec2conn , s. instance) ,
Refresh : InstanceStateRefreshFunc ( ec2conn , instanceId ) ,
StepState : state ,
}
latestInstance , err := WaitForState ( & stateChange )
@ -285,7 +277,7 @@ func (s *StepRunSourceInstance) Cleanup(state multistep.StateBag) {
}
stateChange := StateChangeConf {
Pending : [ ] string { "pending" , "running" , "shutting-down" , "stopped" , "stopping" } ,
Refresh : InstanceStateRefreshFunc ( ec2conn , s . instance ),
Refresh : InstanceStateRefreshFunc ( ec2conn , s . instance .InstanceId ),
Target : "terminated" ,
}