Class: ChefMetal::ImageSpec
- Inherits:
-
Object
- Object
- ChefMetal::ImageSpec
- Defined in:
- lib/chef_metal/image_spec.rb
Overview
Specification for a image. Sufficient information to find and contact it after it has been set up.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#image_data ⇒ Object
readonly
Returns the value of attribute image_data.
Instance Method Summary collapse
-
#driver_url ⇒ Object
URL to the driver.
-
#id ⇒ Object
Globally unique identifier for this image.
-
#initialize(image_data) ⇒ ImageSpec
constructor
A new instance of ImageSpec.
-
#location ⇒ Object
Location of this image.
-
#location=(value) ⇒ Object
Set the location for this image.
- #machine_options ⇒ Object
- #machine_options=(value) ⇒ Object
-
#name ⇒ Object
Name of the image.
-
#save(action_handler) ⇒ Object
Save this image_data to the server.
Constructor Details
#initialize(image_data) ⇒ ImageSpec
Returns a new instance of ImageSpec.
7 8 9 |
# File 'lib/chef_metal/image_spec.rb', line 7 def initialize(image_data) @image_data = image_data end |
Instance Attribute Details
#image_data ⇒ Object (readonly)
Returns the value of attribute image_data.
11 12 13 |
# File 'lib/chef_metal/image_spec.rb', line 11 def image_data @image_data end |
Instance Method Details
#driver_url ⇒ Object
URL to the driver. Convenience for location
57 58 59 |
# File 'lib/chef_metal/image_spec.rb', line 57 def driver_url location ? location['driver_url'] : nil end |
#id ⇒ Object
Globally unique identifier for this image. Does not depend on the image’s location or existence.
17 18 19 |
# File 'lib/chef_metal/image_spec.rb', line 17 def id raise "id unimplemented" end |
#location ⇒ Object
Location of this image. This should be a freeform hash, with enough information for the driver to look it up and create a image 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/image_spec.rb', line 37 def location image_data['location'] end |
#location=(value) ⇒ Object
Set the location for this image.
44 45 46 |
# File 'lib/chef_metal/image_spec.rb', line 44 def location=(value) image_data['location'] = value end |
#machine_options ⇒ Object
48 49 50 |
# File 'lib/chef_metal/image_spec.rb', line 48 def image_data['machine_options'] end |
#machine_options=(value) ⇒ Object
52 53 54 |
# File 'lib/chef_metal/image_spec.rb', line 52 def (value) image_data['machine_options'] = value end |
#name ⇒ Object
Name of the image. Corresponds to the name in “image ‘name’ do” …
24 25 26 |
# File 'lib/chef_metal/image_spec.rb', line 24 def name image_data['id'] end |
#save(action_handler) ⇒ Object
Save this image_data to the server. If you have significant information that could be lost, you should do this as quickly as possible. image_data will be saved automatically for you after allocate_image and ready_image.
66 67 68 |
# File 'lib/chef_metal/image_spec.rb', line 66 def save(action_handler) raise "save unimplemented" end |