lib/vcloud-rest/connection.rb
def wait_task_completion(taskid)
      errormsg = nil
      task = {}

      loop do
        task = get_task(taskid)
        break if task[:status] != 'running'
        sleep 1
      end

      if task[:status] == 'error'
        errormsg = task[:response].css("Error").first
        errormsg = "Error code #{errormsg['majorErrorCode']} - #{errormsg['message']}"
      end

      { :status => task[:status], :errormsg => errormsg,
        :start_time => task[:start_time], :end_time => task[:end_time] }
    end
def wait_task_completion(taskid)
      errormsg = nil
      task = {}

      loop do
        task = get_task(taskid)
        break if task[:status] != 'running'
        sleep 1
      end

      if task[:status] == 'error'
        errormsg = task[:response].css("Error").first
        errormsg = "Error code #{errormsg['majorErrorCode']} - #{errormsg['message']}"
      end

      { :status => task[:status], :errormsg => errormsg,
        :start_time => task[:start_time], :end_time => task[:end_time] }
    end
def wait_task_completion ( taskid ) errormsg = nil task = { } loop do task = get_task ( taskid ) break if task [ :status ] != 'running' sleep 1 end if task [ :status ] == 'error' errormsg = task [ :response ] . css ( "Error" ) . first errormsg = "Error code #{errormsg['majorErrorCode']} - #{errormsg['message']}" end { :status => task [ :status ] , :errormsg => errormsg , :start_time => task [ :start_time ] , :end_time => task [ :end_time ] } end
Poll a given task until completion
Poll a given task until completion