class RbVmomi::VIM::Task

Public Instance Methods

wait_for_completion() click to toggle source

Wait for a task to finish. @return info.result on success. @raise info.error on error.

# File lib/rbvmomi/vim/Task.rb, line 5
def wait_for_completion
  wait_until('info.state') { %w(success error).member? info.state }
  case info.state
  when 'success'
    info.result
  when 'error'
    raise info.error
  end
end
wait_for_progress() { |progress| ... } click to toggle source

Wait for a task to finish, with progress notifications. @return (see wait_for_completion) @raise (see wait_for_completion) @yield [info.progress]

# File lib/rbvmomi/vim/Task.rb, line 19
def wait_for_progress
  wait_until('info.state', 'info.progress') do
    yield info.progress if block_given?
    %w(success error).member? info.state
  end
  case info.state
  when 'success'
    info.result
  when 'error'
    raise info.error
  end
end