Class: ChefMetal::MachineSpec
- Inherits:
-
Object
- Object
- ChefMetal::MachineSpec
- Defined in:
- lib/chef_metal/machine_spec.rb
Overview
Specification for a machine. Sufficient information to find and contact it after it has been set up.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
-
#driver_url ⇒ Object
URL to the driver.
-
#id ⇒ Object
Globally unique identifier for this machine.
-
#initialize(node) ⇒ MachineSpec
constructor
A new instance of MachineSpec.
-
#location ⇒ Object
Location of this machine.
-
#location=(value) ⇒ Object
Set the location for this machine.
-
#name ⇒ Object
Name of the machine.
-
#save(action_handler) ⇒ Object
Save this node to the server.
Constructor Details
#initialize(node) ⇒ MachineSpec
Returns a new instance of MachineSpec.
7 8 9 |
# File 'lib/chef_metal/machine_spec.rb', line 7 def initialize(node) @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
11 12 13 |
# File 'lib/chef_metal/machine_spec.rb', line 11 def node @node end |
Instance Method Details
#driver_url ⇒ Object
URL to the driver. Convenience for location
49 50 51 |
# File 'lib/chef_metal/machine_spec.rb', line 49 def driver_url location ? location['driver_url'] : nil end |
#id ⇒ Object
Globally unique identifier for this machine. Does not depend on the machine’s location or existence.
17 18 19 |
# File 'lib/chef_metal/machine_spec.rb', line 17 def id raise "id unimplemented" end |
#location ⇒ Object
Location of this machine. This should be a freeform hash, with enough information for the driver to look it up and create a Machine object to access it.
This MUST include a ‘driver_url’ attribute with the driver’s URL in it.
chef-metal will do its darnedest to not lose this information.
37 38 39 |
# File 'lib/chef_metal/machine_spec.rb', line 37 def location ('location') end |
#location=(value) ⇒ Object
Set the location for this machine.
44 45 46 |
# File 'lib/chef_metal/machine_spec.rb', line 44 def location=(value) ('location', value) end |
#name ⇒ Object
Name of the machine. Corresponds to the name in “machine ‘name’ do” …
24 25 26 |
# File 'lib/chef_metal/machine_spec.rb', line 24 def name node['name'] end |
#save(action_handler) ⇒ Object
Save this node to the server. If you have significant information that could be lost, you should do this as quickly as possible. Data will be saved automatically for you after allocate_machine and ready_machine.
58 59 60 |
# File 'lib/chef_metal/machine_spec.rb', line 58 def save(action_handler) raise "save unimplemented" end |