Class: Fog::Baremetal::OpenStack::Node

Inherits:
OpenStack::Model show all
Defined in:
lib/fog/openstack/models/baremetal/node.rb

Instance Attribute Summary

Attributes inherited from OpenStack::Model

#project

Instance Method Summary collapse

Methods inherited from OpenStack::Model

#initialize, #save

Constructor Details

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

Instance Method Details

#chassisObject



57
58
59
60
# File 'lib/fog/openstack/models/baremetal/node.rb', line 57

def chassis
  requires :uuid
  service.get_chassis(self.chassis_uuid).body
end

#createObject



32
33
34
35
36
# File 'lib/fog/openstack/models/baremetal/node.rb', line 32

def create
  requires :driver
  merge_attributes(service.create_node(self.attributes).body)
  self
end

#destroyObject



51
52
53
54
55
# File 'lib/fog/openstack/models/baremetal/node.rb', line 51

def destroy
  requires :uuid
  service.delete_node(self.uuid)
  true
end

#metadataObject



79
80
81
82
# File 'lib/fog/openstack/models/baremetal/node.rb', line 79

def 
  requires :uuid
  service.get_node(self.uuid).headers
end

#portsObject



62
63
64
65
# File 'lib/fog/openstack/models/baremetal/node.rb', line 62

def ports
  requires :uuid
  service.list_ports_detailed({:node_uuid => self.uuid}).body['ports']
end

#set_node_maintenance(parameters = nil) ⇒ Object



67
68
69
70
71
# File 'lib/fog/openstack/models/baremetal/node.rb', line 67

def set_node_maintenance(parameters=nil)
  requires :uuid
  service.set_node_maintenance(uuid, parameters)
  true
end

#set_power_state(power_state) ⇒ Object



84
85
86
87
# File 'lib/fog/openstack/models/baremetal/node.rb', line 84

def set_power_state(power_state)
  requires :uuid
  service.set_node_power_state(self.uuid, power_state)
end

#set_provision_state(provision_state) ⇒ Object



89
90
91
92
# File 'lib/fog/openstack/models/baremetal/node.rb', line 89

def set_provision_state(provision_state)
  requires :uuid
  service.set_node_provision_state(self.uuid, provision_state)
end

#unset_node_maintenance(parameters = nil) ⇒ Object



73
74
75
76
77
# File 'lib/fog/openstack/models/baremetal/node.rb', line 73

def unset_node_maintenance(parameters=nil)
  requires :uuid
  service.unset_node_maintenance(uuid, parameters)
  true
end

#update(patch = nil) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fog/openstack/models/baremetal/node.rb', line 38

def update(patch=nil)
  requires :uuid, :driver
  if patch
    merge_attributes(service.patch_node(uuid, patch).body)
  else
    # TODO implement update_node method using PUT method and self.attributes
    # once it is supported by Ironic
    raise ArgumentError, ('You need to provide patch attribute. Ironic does '
                          'not support update by hash yet, only by jsonpatch.')
  end
  self
end