Class: Chef::Provisioning::VirtualboxDriver::Driver

Inherits:
Driver
  • Object
show all
Defined in:
lib/chef/provisioning/virtualbox_driver/driver.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.canonicalize_url(driver_url, config) ⇒ Object

generated by script, required by API.



10
11
12
# File 'lib/chef/provisioning/virtualbox_driver/driver.rb', line 10

def self.canonicalize_url(driver_url, config)
  [ "vbox:#{driver_url} [vboxmanage]", config ]
end

.create_server(name, machine_options) ⇒ Object

  • initialize(driver_url) - create a new driver with the given URL

  • driver_url - a URL representing everything unique about your driver. (NOT credentials)

  • allocate_machine - ask the driver to allocate a machine to you.

  • ready_machine - get the machine “ready” - wait for it to be booted and accessible (for example, accessible via SSH transport).

  • stop_machine - stop the machine.

  • destroy_machine - delete the machine.

  • connect_to_machine - connect to the given machine.



31
32
33
# File 'lib/chef/provisioning/virtualbox_driver/driver.rb', line 31

def Driver.create_server(name, machine_options)
    machine_spec.reference['server_id'] = %x(/usr/local/bin/createvm-q.sh "#{name}" 10)
end

.from_url(driver_url, config) ⇒ Object

generated by script, required by API.



15
16
17
# File 'lib/chef/provisioning/virtualbox_driver/driver.rb', line 15

def self.from_url(driver_url, config)
  Driver.new(driver_url, config)
end

Instance Method Details

#allocate_machine(action_handler, machine_spec, machine_options) ⇒ Object



35
36
37
# File 'lib/chef/provisioning/virtualbox_driver/driver.rb', line 35

def allocate_machine(name, machine_options)
    machine_spec.reference['server_id'] = %x(/usr/local/bin/createvm-q.sh "#{name}" 10)
end

#virtualboxObject



19
20
21
# File 'lib/chef/provisioning/virtualbox_driver/driver.rb', line 19

def virtualbox
  Virtualbox.connect('/usr/local/bin/vboxmanage')
end