Revision dedd3c83

View differences:

src/vmm_mad/remotes/ec2/ec2_driver.rb
736 736
    # +state+: String, is the desired state, needs to be a real state of Amazon ec2:  running, stopped, terminated, pending  
737 737
    # +deploy_id+: String, VM id in EC2
738 738
    def wait_state(state, deploy_id)
739

  
740
        ready = (state == 'stopped') || (state == 'pending') || (state == 'running') || (state == 'terminated')       
739
        ready = (state == 'stopped') || (state == 'pending') || (state == 'running') || (state == 'terminated')
741 740
        raise "Waiting for an invalid state" if !ready
742

  
743 741
        t_init = Time.now
744
        current_state = get_instance(deploy_id).state.name 
745
        while current_state != state
746
           break if Time.now - t_init > @state_change_timeout
747
           sleep 3
748
           current_state = get_instance(deploy_id).state.name
749
        end 
742
        begin
743
            wstate = get_instance(deploy_id).state.name rescue nil
744
            raise "Ended in invalid state" if Time.now - t_init > @state_change_timeout
745
            sleep 3
746
        end while wstate != state
750 747
    end
751 748

  
752 749
    # Load the default values that will be used to create a new instance, if

Also available in: Unified diff