Class: Chef::Provider::MachineImage

Inherits:
LWRPBase
  • Object
show all
Defined in:
lib/chef/provider/machine_image.rb

Instance Method Summary collapse

Instance Method Details

#action_handlerObject


11
12
13
# File 'lib/chef/provider/machine_image.rb', line 11

def action_handler
  @action_handler ||= Chef::Provisioning::ChefProviderActionHandler.new(self)
end

#create_image(image_spec) ⇒ Object


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/chef/provider/machine_image.rb', line 49

def create_image(image_spec)
  # 1. Create the exemplar machine
  machine_provider = Chef::Provider::Machine.new(new_resource, run_context)
  machine_provider.load_current_resource
  machine_provider.action_converge

  # 2. Create the image
  new_driver.allocate_image(action_handler, image_spec, new_resource.image_options,
                            machine_provider.machine_spec)

  # 3. Save the linkage from name -> image id
  image_spec.save(action_handler)

  # 4. Wait for image to be ready
  new_driver.ready_image(action_handler, image_spec, new_resource.image_options)
end

#load_current_resourceObject


15
16
# File 'lib/chef/provider/machine_image.rb', line 15

def load_current_resource
end

#new_driverObject

Get the driver specified in the resource


19
20
21
# File 'lib/chef/provider/machine_image.rb', line 19

def new_driver
  @new_driver ||= run_context.chef_provisioning.driver_for(new_resource.driver)
end