Class: Chef::Provisioning::ImageSpec
- Inherits:
-
Object
- Object
- Chef::Provisioning::ImageSpec
- Defined in:
- lib/chef/provisioning/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.
8 9 10 |
# File 'lib/chef/provisioning/image_spec.rb', line 8 def initialize(image_data) @image_data = image_data end |
Instance Attribute Details
#image_data ⇒ Object (readonly)
Returns the value of attribute image_data.
12 13 14 |
# File 'lib/chef/provisioning/image_spec.rb', line 12 def image_data @image_data end |
Instance Method Details
#driver_url ⇒ Object
URL to the driver. Convenience for location
58 59 60 |
# File 'lib/chef/provisioning/image_spec.rb', line 58 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.
18 19 20 |
# File 'lib/chef/provisioning/image_spec.rb', line 18 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-provisioning will do its darnedest to not lose this information.
38 39 40 |
# File 'lib/chef/provisioning/image_spec.rb', line 38 def location image_data['location'] end |
#location=(value) ⇒ Object
Set the location for this image.
45 46 47 |
# File 'lib/chef/provisioning/image_spec.rb', line 45 def location=(value) image_data['location'] = value end |
#machine_options ⇒ Object
49 50 51 |
# File 'lib/chef/provisioning/image_spec.rb', line 49 def image_data['machine_options'] end |
#machine_options=(value) ⇒ Object
53 54 55 |
# File 'lib/chef/provisioning/image_spec.rb', line 53 def (value) image_data['machine_options'] = value end |
#name ⇒ Object
Name of the image. Corresponds to the name in “image ‘name’ do” …
25 26 27 |
# File 'lib/chef/provisioning/image_spec.rb', line 25 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.
67 68 69 |
# File 'lib/chef/provisioning/image_spec.rb', line 67 def save(action_handler) raise "save unimplemented" end |