Class: VCloud::Task
- Inherits:
-
BaseVCloudEntity
- Object
- BaseVCloudEntity
- VCloud::Task
- Includes:
- ParsesXml
- Defined in:
- lib/vcloud/user/task.rb
Overview
Represents an asynchronous operation in vCloud Director
Defined Under Namespace
Modules: Status
Constant Summary collapse
Instance Method Summary collapse
-
#wait_to_finish(timeout = 60 * 10) { ... } ⇒ Object
Wait until the status of the task is set to indicate that the task has completed.
Methods included from ParsesXml
Methods inherited from BaseVCloudEntity
attr_accessor, attr_reader, attr_writer, from_reference, inherited, #initialize, type
Methods included from RestApi
#build_generic_http_opts, #create, #delete, #http_request, #parse_response, #post, #refresh, #update
Constructor Details
This class inherits a constructor from VCloud::BaseVCloudEntity
Instance Method Details
#wait_to_finish(timeout = 60 * 10) { ... } ⇒ Object
Wait until the status of the task is set to indicate that the task has completed
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/vcloud/user/task.rb', line 22 def wait_to_finish(timeout = 60 * 10) first_run = true Timeout::timeout(timeout) do until @@completed_statuses.include?(self.status) sleep 3 if not first_run refresh first_run = false end end yield(self) if block_given? end |