Class: Fog::Proxmox::Compute::Task
- Inherits:
-
Model
- Object
- Model
- Fog::Proxmox::Compute::Task
- Defined in:
- lib/fog/compute/proxmox/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 55 |
# File 'lib/fog/compute/proxmox/models/task.rb', line 48 def initialize(new_attributes = {}) prepare_service_value(new_attributes) attributes[:node_id] = new_attributes[:node_id] unless new_attributes[:node_id].nil? attributes[:upid] = new_attributes[:upid] unless new_attributes[:upid].nil? attributes[:upid] = new_attributes['upid'] unless new_attributes['upid'].nil? requires :node_id, :upid super(new_attributes) end |
Instance Method Details
#finished? ⇒ Boolean
61 62 63 |
# File 'lib/fog/compute/proxmox/models/task.rb', line 61 def finished? status == 'stopped' end |
#reload ⇒ Object
73 74 75 76 |
# File 'lib/fog/compute/proxmox/models/task.rb', line 73 def reload object = collection.get(upid) merge_attributes(object.attributes) end |
#running? ⇒ Boolean
65 66 67 |
# File 'lib/fog/compute/proxmox/models/task.rb', line 65 def running? status == 'running' end |
#stop ⇒ Object
69 70 71 |
# File 'lib/fog/compute/proxmox/models/task.rb', line 69 def stop service.stop_task(node_id, upid) end |
#succeeded? ⇒ Boolean
57 58 59 |
# File 'lib/fog/compute/proxmox/models/task.rb', line 57 def succeeded? finished? && exitstatus == 'OK' end |