Method: RbVmomi::VIM::ManagedObject#wait_until

Defined in:
lib/rbvmomi/vim/ManagedObject.rb

#wait_until(*pathSet) { ... } ⇒ Object

TODO:

Pass the current property values to the block.

Wait for updates on an object until a condition becomes true.

Parameters:

  • pathSet (Array)

    Property paths to wait for updates to.

Yields:

  • Called when an update to a subscribed property occurs.

Yield Returns:

  • (Boolean)

    Whether to stop waiting.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rbvmomi/vim/ManagedObject.rb', line 12

def wait_until *pathSet, &b
  all = pathSet.empty?
  filter = _connection.propertyCollector.CreateFilter :spec => {
    :propSet => [{ :type => self.class.wsdl_name, :all => all, :pathSet => pathSet }],
    :objectSet => [{ :obj => self }],
  }, :partialUpdates => false
  ver = ''
  loop do
    result = _connection.propertyCollector.WaitForUpdates(:version => ver)
    ver = result.version
    if x = b.call
      return x
    end
  end
ensure
  filter.DestroyPropertyFilter if filter
end