Class: Chef::Provisioning::ImageSpec

Inherits:
Object
  • Object
show all
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

ChefImageSpec

Instance Attribute Summary collapse

Instance Method Summary collapse

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_dataObject (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_urlObject

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

#idObject

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

#locationObject

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_optionsObject


49
50
51
# File 'lib/chef/provisioning/image_spec.rb', line 49

def machine_options
  image_data['machine_options']
end

#machine_options=(value) ⇒ Object


53
54
55
# File 'lib/chef/provisioning/image_spec.rb', line 53

def machine_options=(value)
  image_data['machine_options'] = value
end

#nameObject

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