Class: DaptivChefCI::VirtualBoxDriver
- Inherits:
-
Object
- Object
- DaptivChefCI::VirtualBoxDriver
- Defined in:
- lib/daptiv-chef-ci/virtualbox_driver.rb
Instance Method Summary collapse
-
#cleanup_vms(box_name) ⇒ Object
Remove any running vms that have the same name as this box.
-
#initialize(shell) ⇒ VirtualBoxDriver
constructor
A new instance of VirtualBoxDriver.
Constructor Details
#initialize(shell) ⇒ VirtualBoxDriver
Returns a new instance of VirtualBoxDriver.
7 8 9 10 |
# File 'lib/daptiv-chef-ci/virtualbox_driver.rb', line 7 def initialize(shell) @logger = Log4r::Logger.new("daptiv_chef_ci::virtual_box") @shell = shell end |
Instance Method Details
#cleanup_vms(box_name) ⇒ Object
Remove any running vms that have the same name as this box
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/daptiv-chef-ci/virtualbox_driver.rb', line 13 def cleanup_vms(box_name) list_all_running_vms().each do |vm| if vm.include?(box_name) machine_name = vm.split[0] @logger.debug("Found matching VBox #{machine_name} - Running") poweroff(machine_name) unregister(machine_name) else @logger.debug("Found no matching VBox #{machine_name}") end end end |