Class: Fog::Proxmox::Compute::Task
- Inherits:
-
Model
- Object
- Model
- Fog::Proxmox::Compute::Task
- Defined in:
- lib/fog/proxmox/compute/models/task.rb
Overview
class Task model of a node
Instance Method Summary collapse
- #finished? ⇒ Boolean
-
#initialize(new_attributes = {}) ⇒ Task
constructor
A new instance of Task.
- #reload ⇒ Object
- #running? ⇒ Boolean
- #stop ⇒ Object
- #succeeded? ⇒ Boolean
Constructor Details
#initialize(new_attributes = {}) ⇒ Task
Returns a new instance of Task.
48 49 50 51 52 53 54 |
# File 'lib/fog/proxmox/compute/models/task.rb', line 48 def initialize(new_attributes = {}) prepare_service_value(new_attributes) Fog::Proxmox::Attributes.set_attr_and_sym('node_id', attributes, new_attributes) Fog::Proxmox::Attributes.set_attr_and_sym('upid', attributes, new_attributes) requires :node_id, :upid super(new_attributes) end |
Instance Method Details
#finished? ⇒ Boolean
60 61 62 |
# File 'lib/fog/proxmox/compute/models/task.rb', line 60 def finished? status == 'stopped' end |
#reload ⇒ Object
72 73 74 75 |
# File 'lib/fog/proxmox/compute/models/task.rb', line 72 def reload object = collection.get(upid) merge_attributes(object.attributes) end |
#running? ⇒ Boolean
64 65 66 |
# File 'lib/fog/proxmox/compute/models/task.rb', line 64 def running? status == 'running' end |
#stop ⇒ Object
68 69 70 |
# File 'lib/fog/proxmox/compute/models/task.rb', line 68 def stop service.stop_task(node_id, upid) end |
#succeeded? ⇒ Boolean
56 57 58 |
# File 'lib/fog/proxmox/compute/models/task.rb', line 56 def succeeded? finished? && exitstatus == 'OK' end |