Class: Fog::Compute::Proxmox::Task

Inherits:
Proxmox::Model show all
Defined in:
lib/fog/compute/proxmox/models/task.rb

Overview

class Task model of a node

Instance Method Summary collapse

Methods inherited from Proxmox::Model

#create, #destroy, #initialize, #inspect, #update

Constructor Details

This class inherits a constructor from Fog::Proxmox::Model

Instance Method Details

#finished?Boolean


63
64
65
# File 'lib/fog/compute/proxmox/models/task.rb', line 63

def finished?
  status == 'stopped'
end

#new(attributes = {}) ⇒ Object


50
51
52
53
# File 'lib/fog/compute/proxmox/models/task.rb', line 50

def new(attributes = {})
  requires :node
  super({ node: node }.merge(attributes))
end

#reloadObject


76
77
78
79
80
# File 'lib/fog/compute/proxmox/models/task.rb', line 76

def reload
  requires :upid
  object = collection.get(upid)
  merge_attributes(object.attributes)
end

#running?Boolean


67
68
69
# File 'lib/fog/compute/proxmox/models/task.rb', line 67

def running?
  status == 'running'
end

#stopObject


71
72
73
74
# File 'lib/fog/compute/proxmox/models/task.rb', line 71

def stop
  requires :node, :upid
  service.stop_task(node, upid)
end

#succeeded?Boolean


59
60
61
# File 'lib/fog/compute/proxmox/models/task.rb', line 59

def succeeded?
  finished? && exitstatus == 'OK'
end

#to_sObject


55
56
57
# File 'lib/fog/compute/proxmox/models/task.rb', line 55

def to_s
  upid
end