Class: RbVmomi::VIM::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/rbvmomi/extensions.rb

Instance Method Summary collapse

Instance Method Details

#wait_for_completionObject



98
99
100
101
102
103
104
105
106
# File 'lib/rbvmomi/extensions.rb', line 98

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_progressObject



108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/rbvmomi/extensions.rb', line 108

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