vagrantup 0.8.10 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +77 -1
- data/Gemfile +0 -14
- data/LICENSE +1 -1
- data/bin/vagrant +47 -20
- data/config/default.rb +6 -14
- data/lib/vagrant/action/box/destroy.rb +7 -3
- data/lib/vagrant/action/box/download.rb +8 -8
- data/lib/vagrant/action/box/package.rb +2 -2
- data/lib/vagrant/action/box/unpackage.rb +13 -7
- data/lib/vagrant/action/box/verify.rb +5 -5
- data/lib/vagrant/action/builder.rb +23 -19
- data/lib/vagrant/action/builtin.rb +117 -79
- data/lib/vagrant/action/env/set.rb +7 -4
- data/lib/vagrant/action/environment.rb +3 -41
- data/lib/vagrant/action/general/package.rb +14 -29
- data/lib/vagrant/action/general/validate.rb +2 -2
- data/lib/vagrant/action/runner.rb +53 -0
- data/lib/vagrant/action/vm/boot.rb +9 -9
- data/lib/vagrant/action/vm/check_accessible.rb +2 -2
- data/lib/vagrant/action/vm/check_box.rb +10 -12
- data/lib/vagrant/action/vm/check_guest_additions.rb +8 -8
- data/lib/vagrant/action/vm/check_port_collisions.rb +85 -0
- data/lib/vagrant/action/vm/clean_machine_folder.rb +4 -4
- data/lib/vagrant/action/vm/clear_forwarded_ports.rb +3 -11
- data/lib/vagrant/action/vm/clear_network_interfaces.rb +31 -0
- data/lib/vagrant/action/vm/clear_shared_folders.rb +2 -11
- data/lib/vagrant/action/vm/customize.rb +19 -9
- data/lib/vagrant/action/vm/destroy.rb +4 -4
- data/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb +2 -12
- data/lib/vagrant/action/vm/discard_state.rb +4 -4
- data/lib/vagrant/action/vm/export.rb +13 -8
- data/lib/vagrant/action/vm/forward_ports.rb +55 -102
- data/lib/vagrant/action/vm/halt.rb +9 -6
- data/lib/vagrant/action/vm/host_name.rb +4 -4
- data/lib/vagrant/action/vm/import.rb +19 -10
- data/lib/vagrant/action/vm/match_mac_address.rb +4 -9
- data/lib/vagrant/action/vm/network.rb +300 -94
- data/lib/vagrant/action/vm/nfs.rb +41 -26
- data/lib/vagrant/action/vm/package.rb +1 -1
- data/lib/vagrant/action/vm/package_vagrantfile.rb +5 -2
- data/lib/vagrant/action/vm/provision.rb +42 -13
- data/lib/vagrant/action/vm/provisioner_cleanup.rb +2 -2
- data/lib/vagrant/action/vm/{clear_nfs_exports.rb → prune_nfs_exports.rb} +7 -7
- data/lib/vagrant/action/vm/resume.rb +4 -4
- data/lib/vagrant/action/vm/setup_package_files.rb +54 -0
- data/lib/vagrant/action/vm/share_folders.rb +63 -39
- data/lib/vagrant/action/vm/suspend.rb +4 -4
- data/lib/vagrant/action/warden.rb +13 -6
- data/lib/vagrant/action.rb +45 -123
- data/lib/vagrant/box.rb +9 -55
- data/lib/vagrant/box_collection.rb +22 -17
- data/lib/vagrant/cli.rb +62 -47
- data/lib/vagrant/command/base.rb +135 -90
- data/lib/vagrant/command/box.rb +46 -21
- data/lib/vagrant/command/box_add.rb +33 -0
- data/lib/vagrant/command/box_list.rb +25 -0
- data/lib/vagrant/command/box_remove.rb +23 -0
- data/lib/vagrant/command/box_repackage.rb +23 -0
- data/lib/vagrant/command/destroy.rb +16 -5
- data/lib/vagrant/command/halt.rb +25 -7
- data/lib/vagrant/command/init.rb +30 -7
- data/lib/vagrant/command/package.rb +49 -18
- data/lib/vagrant/command/provision.rb +22 -9
- data/lib/vagrant/command/reload.rb +18 -5
- data/lib/vagrant/command/resume.rb +18 -5
- data/lib/vagrant/command/ssh.rb +69 -31
- data/lib/vagrant/command/ssh_config.rb +37 -22
- data/lib/vagrant/command/status.rb +22 -20
- data/lib/vagrant/command/suspend.rb +18 -5
- data/lib/vagrant/command/up.rb +41 -8
- data/lib/vagrant/command.rb +18 -20
- data/lib/vagrant/communication/base.rb +56 -0
- data/lib/vagrant/communication/ssh.rb +200 -0
- data/lib/vagrant/communication.rb +7 -0
- data/lib/vagrant/config/base.rb +18 -26
- data/lib/vagrant/config/container.rb +37 -0
- data/lib/vagrant/config/error_recorder.rb +1 -1
- data/lib/vagrant/config/loader.rb +125 -0
- data/lib/vagrant/config/nfs.rb +1 -3
- data/lib/vagrant/config/package.rb +1 -3
- data/lib/vagrant/config/ssh.rb +31 -16
- data/lib/vagrant/config/top.rb +36 -25
- data/lib/vagrant/config/vagrant.rb +2 -5
- data/lib/vagrant/config/vm/provisioner.rb +16 -20
- data/lib/vagrant/config/vm/sub_vm.rb +1 -1
- data/lib/vagrant/config/vm.rb +115 -56
- data/lib/vagrant/config.rb +29 -103
- data/lib/vagrant/data_store.rb +23 -15
- data/lib/vagrant/downloaders/base.rb +7 -5
- data/lib/vagrant/downloaders/file.rb +4 -4
- data/lib/vagrant/downloaders/http.rb +4 -5
- data/lib/vagrant/driver/virtualbox.rb +121 -0
- data/lib/vagrant/driver/virtualbox_4_0.rb +411 -0
- data/lib/vagrant/driver/virtualbox_4_1.rb +411 -0
- data/lib/vagrant/driver/virtualbox_base.rb +284 -0
- data/lib/vagrant/driver.rb +7 -0
- data/lib/vagrant/environment.rb +221 -240
- data/lib/vagrant/errors.rb +74 -25
- data/lib/vagrant/guest/arch.rb +48 -0
- data/lib/vagrant/{systems → guest}/base.rb +30 -18
- data/lib/vagrant/guest/debian.rb +61 -0
- data/lib/vagrant/{systems → guest}/freebsd.rb +11 -18
- data/lib/vagrant/guest/gentoo.rb +32 -0
- data/lib/vagrant/{systems → guest}/linux/config.rb +2 -4
- data/lib/vagrant/guest/linux/error.rb +9 -0
- data/lib/vagrant/guest/linux.rb +78 -0
- data/lib/vagrant/guest/redhat.rb +66 -0
- data/lib/vagrant/guest/solaris.rb +114 -0
- data/lib/vagrant/{systems → guest}/suse.rb +2 -2
- data/lib/vagrant/guest/ubuntu.rb +23 -0
- data/lib/vagrant/guest.rb +16 -0
- data/lib/vagrant/hosts/arch.rb +7 -3
- data/lib/vagrant/hosts/base.rb +36 -46
- data/lib/vagrant/hosts/bsd.rb +53 -16
- data/lib/vagrant/hosts/fedora.rb +14 -0
- data/lib/vagrant/hosts/freebsd.rb +6 -36
- data/lib/vagrant/hosts/linux.rb +45 -20
- data/lib/vagrant/hosts/windows.rb +16 -0
- data/lib/vagrant/hosts.rb +23 -6
- data/lib/vagrant/provisioners/base.rb +11 -34
- data/lib/vagrant/provisioners/chef.rb +30 -26
- data/lib/vagrant/provisioners/chef_client.rb +37 -23
- data/lib/vagrant/provisioners/chef_solo.rb +61 -16
- data/lib/vagrant/provisioners/puppet.rb +70 -38
- data/lib/vagrant/provisioners/puppet_server.rb +12 -13
- data/lib/vagrant/provisioners/shell.rb +24 -24
- data/lib/vagrant/provisioners.rb +10 -7
- data/lib/vagrant/registry.rb +49 -0
- data/lib/vagrant/ssh.rb +82 -153
- data/lib/vagrant/ui.rb +118 -50
- data/lib/vagrant/util/busy.rb +1 -1
- data/lib/vagrant/util/file_mode.rb +12 -0
- data/lib/vagrant/util/network_ip.rb +28 -0
- data/lib/vagrant/util/platform.rb +1 -0
- data/lib/vagrant/util/subprocess.rb +227 -0
- data/lib/vagrant/version.rb +1 -1
- data/lib/vagrant/vm.rb +111 -97
- data/lib/vagrant.rb +132 -5
- data/tasks/acceptance.rake +3 -3
- data/tasks/test.rake +7 -2
- data/templates/commands/init/Vagrantfile.erb +11 -4
- data/templates/{ssh_config.erb → commands/ssh_config/config.erb} +0 -0
- data/templates/guests/arch/network_dhcp.erb +7 -0
- data/templates/guests/arch/network_static.erb +7 -0
- data/templates/guests/debian/network_dhcp.erb +6 -0
- data/templates/guests/debian/network_static.erb +7 -0
- data/templates/guests/gentoo/network_dhcp.erb +4 -0
- data/templates/guests/gentoo/network_static.erb +4 -0
- data/templates/guests/redhat/network_dhcp.erb +6 -0
- data/templates/guests/redhat/network_static.erb +7 -0
- data/templates/locales/en.yml +241 -122
- data/templates/{chef_server_client.erb → provisioners/chef_client/client.erb} +0 -0
- data/templates/{chef_solo_solo.erb → provisioners/chef_solo/solo.erb} +0 -0
- data/test/acceptance/base.rb +10 -10
- data/test/acceptance/box_test.rb +28 -6
- data/test/acceptance/destroy_test.rb +1 -1
- data/test/acceptance/halt_test.rb +4 -4
- data/test/acceptance/init_test.rb +3 -3
- data/test/acceptance/networking/host_only_test.rb +37 -0
- data/test/acceptance/networking/port_forward_test.rb +125 -0
- data/test/acceptance/package_test.rb +46 -0
- data/test/acceptance/provisioning/basic_test.rb +61 -0
- data/test/acceptance/provisioning/chef_solo_test.rb +37 -0
- data/test/acceptance/provisioning/shell_test.rb +53 -0
- data/test/acceptance/resume_test.rb +1 -1
- data/test/acceptance/skeletons/chef_solo_basic/README.md +3 -0
- data/test/acceptance/skeletons/chef_solo_basic/cookbooks/basic/recipes/default.rb +5 -0
- data/test/acceptance/skeletons/chef_solo_json/README.md +3 -0
- data/test/acceptance/skeletons/chef_solo_json/cookbooks/basic/recipes/default.rb +6 -0
- data/test/acceptance/skeletons/provisioner_multi/README.md +3 -0
- data/test/acceptance/skeletons/provisioner_multi/cookbooks/basic/recipes/default.rb +5 -0
- data/test/acceptance/ssh_test.rb +7 -2
- data/test/acceptance/support/config.rb +1 -1
- data/test/acceptance/support/isolated_environment.rb +41 -150
- data/test/acceptance/support/matchers/match_output.rb +1 -1
- data/test/acceptance/support/matchers/succeed.rb +14 -0
- data/test/acceptance/support/network_tests.rb +29 -0
- data/test/acceptance/support/output.rb +9 -1
- data/test/acceptance/support/shared/base_context.rb +16 -9
- data/test/acceptance/support/shared/command_examples.rb +4 -4
- data/test/acceptance/suspend_test.rb +1 -1
- data/test/acceptance/up_basic_test.rb +26 -7
- data/test/acceptance/up_with_box_url.rb +1 -1
- data/test/acceptance/vagrant_test.rb +1 -1
- data/test/acceptance/version_test.rb +0 -5
- data/test/support/isolated_environment.rb +46 -0
- data/test/{acceptance/support → support}/tempdir.rb +0 -0
- data/test/unit/base.rb +21 -0
- data/test/unit/support/isolated_environment.rb +39 -0
- data/test/unit/support/shared/base_context.rb +30 -0
- data/test/unit/vagrant/action/builder_test.rb +126 -177
- data/test/unit/vagrant/action/environment_test.rb +10 -21
- data/test/unit/vagrant/action/runner_test.rb +65 -0
- data/test/unit/vagrant/action/warden_test.rb +64 -97
- data/test/unit/vagrant/box_collection_test.rb +44 -33
- data/test/unit/vagrant/box_test.rb +25 -65
- data/test/unit/vagrant/command/base_test.rb +141 -14
- data/test/unit/vagrant/config/base_test.rb +16 -43
- data/test/unit/vagrant/config/loader_test.rb +79 -0
- data/test/unit/vagrant/config/top_test.rb +69 -0
- data/test/unit/vagrant/config/vm_test.rb +62 -47
- data/test/unit/vagrant/config_test.rb +16 -151
- data/test/unit/vagrant/data_store_test.rb +43 -61
- data/test/unit/vagrant/downloaders/base_test.rb +12 -22
- data/test/unit/vagrant/downloaders/file_test.rb +58 -31
- data/test/unit/vagrant/downloaders/http_test.rb +12 -86
- data/test/unit/vagrant/environment_test.rb +107 -536
- data/test/unit/vagrant/hosts_test.rb +36 -0
- data/test/unit/vagrant/registry_test.rb +56 -0
- data/test/unit/vagrant/util/file_checksum_test.rb +23 -0
- data/test/unit/vagrant/util/hash_with_indifferent_access_test.rb +23 -24
- data/test/unit/vagrant/util/network_ip_test.rb +17 -0
- data/test/unit/vagrant/util/retryable_test.rb +90 -34
- data/test/unit/vagrant_test.rb +27 -0
- data/test/{unit → unit_legacy}/locales/en.yml +0 -0
- data/test/{unit → unit_legacy}/test_helper.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/destroy_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/download_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/package_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/unpackage_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/verify_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/env/set_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/general/package_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/general/validate_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/boot_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/check_accessible_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/check_box_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/check_guest_additions_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clean_machine_folder_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clear_forwarded_ports_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clear_nfs_exports_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clear_shared_folders_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/customize_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/destroy_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/destroy_unused_network_interfaces_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/discard_state_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/export_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/forward_ports_helpers_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/forward_ports_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/halt_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/host_name_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/import_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/match_mac_address_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/modify_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/network_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/nfs_helpers_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/nfs_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/package_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/package_vagrantfile_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/provision_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/provisioner_cleanup_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/resume_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/share_folders_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/suspend_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action_test.rb +0 -0
- data/test/unit_legacy/vagrant/box_collection_test.rb +45 -0
- data/test/unit_legacy/vagrant/box_test.rb +74 -0
- data/test/{unit → unit_legacy}/vagrant/cli_test.rb +0 -0
- data/test/unit_legacy/vagrant/command/base_test.rb +23 -0
- data/test/{unit → unit_legacy}/vagrant/command/group_base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/command/helpers_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/command/init_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/command/package_test.rb +0 -0
- data/test/unit_legacy/vagrant/config/base_test.rb +52 -0
- data/test/{unit → unit_legacy}/vagrant/config/error_recorder_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/config/ssh_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/config/vagrant_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/config/vm/provisioner_test.rb +0 -0
- data/test/unit_legacy/vagrant/config/vm_test.rb +47 -0
- data/test/unit_legacy/vagrant/config_test.rb +148 -0
- data/test/unit_legacy/vagrant/downloaders/http_test.rb +93 -0
- data/test/unit_legacy/vagrant/environment_test.rb +539 -0
- data/test/{unit → unit_legacy}/vagrant/errors_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/hosts/base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/hosts/bsd_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/hosts/linux_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/plugin_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/chef_client_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/chef_solo_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/chef_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/puppet_server_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/puppet_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/shell_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/ssh/session_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/ssh_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/systems/base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/systems/linux_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/busy_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/counter_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/platform_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/stacked_proc_runner_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/template_renderer_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/vm_test.rb +0 -0
- data/vagrant.gemspec +7 -9
- metadata +183 -179
- data/keys/vagrant.ppk +0 -26
- data/lib/vagrant/action/box.rb +0 -11
- data/lib/vagrant/action/env.rb +0 -7
- data/lib/vagrant/action/general.rb +0 -8
- data/lib/vagrant/action/vm/forward_ports_helpers.rb +0 -28
- data/lib/vagrant/action/vm/modify.rb +0 -37
- data/lib/vagrant/action/vm/nfs_helpers.rb +0 -11
- data/lib/vagrant/action/vm.rb +0 -34
- data/lib/vagrant/command/group_base.rb +0 -107
- data/lib/vagrant/command/helpers.rb +0 -33
- data/lib/vagrant/command/named_base.rb +0 -14
- data/lib/vagrant/command/upgrade_to_060.rb +0 -45
- data/lib/vagrant/command/version.rb +0 -13
- data/lib/vagrant/ssh/session.rb +0 -136
- data/lib/vagrant/systems/arch.rb +0 -34
- data/lib/vagrant/systems/debian.rb +0 -36
- data/lib/vagrant/systems/gentoo.rb +0 -27
- data/lib/vagrant/systems/linux/error.rb +0 -9
- data/lib/vagrant/systems/linux.rb +0 -82
- data/lib/vagrant/systems/redhat.rb +0 -48
- data/lib/vagrant/systems/solaris.rb +0 -113
- data/lib/vagrant/systems/ubuntu.rb +0 -17
- data/lib/vagrant/systems.rb +0 -13
- data/templates/network_entry_arch.erb +0 -9
- data/templates/network_entry_debian.erb +0 -8
- data/templates/network_entry_gentoo.erb +0 -5
- data/templates/network_entry_redhat.erb +0 -9
- data/test/unit/vagrant/ui_test.rb +0 -29
@@ -0,0 +1,85 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Action
|
3
|
+
module VM
|
4
|
+
# Action that checks to make sure there are no forwarded port collisions,
|
5
|
+
# and raises an exception if there is.
|
6
|
+
class CheckPortCollisions
|
7
|
+
def initialize(app, env)
|
8
|
+
@app = app
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
# For the handlers...
|
13
|
+
@env = env
|
14
|
+
|
15
|
+
# Figure out how we handle port collisions. By default we error.
|
16
|
+
handler = env[:port_collision_handler] || :error
|
17
|
+
|
18
|
+
# Read our forwarded ports, if we have any, to override what
|
19
|
+
# we have configured.
|
20
|
+
current = {}
|
21
|
+
env[:vm].driver.read_forwarded_ports.each do |nic, name, hostport, guestport|
|
22
|
+
current[name] = hostport.to_i
|
23
|
+
end
|
24
|
+
|
25
|
+
existing = env[:vm].driver.read_used_ports
|
26
|
+
env[:vm].config.vm.forwarded_ports.each do |options|
|
27
|
+
# Use the proper port, whether that be the configured port or the
|
28
|
+
# port that is currently on use of the VM.
|
29
|
+
hostport = options[:hostport].to_i
|
30
|
+
hostport = current[options[:name]] if current.has_key?(options[:name])
|
31
|
+
|
32
|
+
if existing.include?(hostport)
|
33
|
+
# We have a collision! Handle it
|
34
|
+
send("handle_#{handler}".to_sym, options, existing)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
@app.call(env)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Handles a port collision by raising an exception.
|
42
|
+
def handle_error(options, existing_ports)
|
43
|
+
raise Errors::ForwardPortCollisionResume
|
44
|
+
end
|
45
|
+
|
46
|
+
# Handles a port collision by attempting to fix it.
|
47
|
+
def handle_correct(options, existing_ports)
|
48
|
+
# We need to keep this for messaging purposes
|
49
|
+
original_hostport = options[:hostport]
|
50
|
+
|
51
|
+
if !options[:auto]
|
52
|
+
# Auto fixing is disabled for this port forward, so we
|
53
|
+
# must throw an error so the user can fix it.
|
54
|
+
raise Errors::ForwardPortCollision, :host_port => options[:hostport].to_s,
|
55
|
+
:guest_port => options[:guestport].to_s
|
56
|
+
end
|
57
|
+
|
58
|
+
# Get the auto port range and get rid of the used ports and
|
59
|
+
# ports which are being used in other forwards so we're just
|
60
|
+
# left with available ports.
|
61
|
+
range = @env[:vm].config.vm.auto_port_range.to_a
|
62
|
+
range -= @env[:vm].config.vm.forwarded_ports.collect { |opts| opts[:hostport].to_i }
|
63
|
+
range -= existing_ports
|
64
|
+
|
65
|
+
if range.empty?
|
66
|
+
raise Errors::ForwardPortAutolistEmpty, :vm_name => @env[:vm].name,
|
67
|
+
:host_port => options[:hostport].to_s,
|
68
|
+
:guest_port => options[:guestport].to_s
|
69
|
+
end
|
70
|
+
|
71
|
+
# Set the port up to be the first one and add that port to
|
72
|
+
# the used list.
|
73
|
+
options[:hostport] = range.shift
|
74
|
+
existing_ports << options[:hostport]
|
75
|
+
|
76
|
+
# Notify the user
|
77
|
+
@env[:ui].info(I18n.t("vagrant.actions.vm.forward_ports.fixed_collision",
|
78
|
+
:host_port => original_hostport.to_s,
|
79
|
+
:guest_port => options[:guestport].to_s,
|
80
|
+
:new_port => options[:hostport]))
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
3
|
module Vagrant
|
4
|
-
|
4
|
+
module Action
|
5
5
|
module VM
|
6
6
|
# Cleans up the VirtualBox machine folder for any ".xml-prev"
|
7
7
|
# files which VirtualBox may have left over. This is a bug in
|
@@ -13,12 +13,12 @@ module Vagrant
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def call(env)
|
16
|
-
clean_machine_folder
|
16
|
+
clean_machine_folder(env[:vm].driver.read_machine_folder)
|
17
17
|
@app.call(env)
|
18
18
|
end
|
19
19
|
|
20
|
-
def clean_machine_folder
|
21
|
-
folder = File.join(
|
20
|
+
def clean_machine_folder(machine_folder)
|
21
|
+
folder = File.join(machine_folder, "*")
|
22
22
|
|
23
23
|
# Small safeguard against potentially unwanted rm-rf, since the default
|
24
24
|
# machine folder will typically always be greater than 10 characters long.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Vagrant
|
2
|
-
|
2
|
+
module Action
|
3
3
|
module VM
|
4
4
|
class ClearForwardedPorts
|
5
5
|
def initialize(app, env)
|
@@ -7,17 +7,9 @@ module Vagrant
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def call(env)
|
10
|
-
|
11
|
-
|
10
|
+
env[:ui].info I18n.t("vagrant.actions.vm.clear_forward_ports.deleting")
|
11
|
+
env[:vm].driver.clear_forwarded_ports
|
12
12
|
|
13
|
-
vm.network_adapters.each do |na|
|
14
|
-
na.nat_driver.forwarded_ports.dup.each do |fp|
|
15
|
-
fp.destroy
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
env["vm.modify"].call(proc)
|
21
13
|
@app.call(env)
|
22
14
|
end
|
23
15
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Action
|
3
|
+
module VM
|
4
|
+
class ClearNetworkInterfaces
|
5
|
+
def initialize(app, env)
|
6
|
+
@app = app
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
# Create the adapters array to make all adapters nothing.
|
11
|
+
# We do adapters 2 to 8 because that is every built-in adapter
|
12
|
+
# excluding the NAT adapter on port 1 which Vagrant always
|
13
|
+
# expects to exist.
|
14
|
+
adapters = []
|
15
|
+
2.upto(8).each do |i|
|
16
|
+
adapters << {
|
17
|
+
:adapter => i,
|
18
|
+
:type => :none
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
# "Enable" all the adapters we setup.
|
23
|
+
env[:ui].info I18n.t("vagrant.actions.vm.clear_network_interfaces.deleting")
|
24
|
+
env[:vm].driver.enable_adapters(adapters)
|
25
|
+
|
26
|
+
@app.call(env)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Vagrant
|
2
|
-
|
2
|
+
module Action
|
3
3
|
module VM
|
4
4
|
class ClearSharedFolders
|
5
5
|
def initialize(app, env)
|
@@ -8,17 +8,8 @@ module Vagrant
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def call(env)
|
11
|
-
|
12
|
-
if vm.shared_folders.length > 0
|
13
|
-
env.ui.info I18n.t("vagrant.actions.vm.clear_shared_folders.deleting")
|
11
|
+
env[:vm].driver.clear_shared_folders
|
14
12
|
|
15
|
-
vm.shared_folders.dup.each do |shared_folder|
|
16
|
-
shared_folder.destroy
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
env["vm.modify"].call(proc)
|
22
13
|
@app.call(env)
|
23
14
|
end
|
24
15
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Vagrant
|
2
|
-
|
2
|
+
module Action
|
3
3
|
module VM
|
4
4
|
class Customize
|
5
5
|
def initialize(app, env)
|
@@ -7,15 +7,25 @@ module Vagrant
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def call(env)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
customizations = env[:vm].config.vm.customizations
|
11
|
+
if !customizations.empty?
|
12
|
+
env[:ui].info I18n.t("vagrant.actions.vm.customize.running")
|
13
|
+
|
14
|
+
# Execute each customization command.
|
15
|
+
customizations.each do |command|
|
16
|
+
processed_command = command.collect do |arg|
|
17
|
+
arg = env[:vm].uuid if arg == :id
|
18
|
+
arg
|
19
|
+
end
|
16
20
|
|
17
|
-
|
18
|
-
|
21
|
+
result = env[:vm].driver.execute_command(processed_command)
|
22
|
+
if result.exit_code != 0
|
23
|
+
raise Errors::VMCustomizationFailed, {
|
24
|
+
:command => processed_command.inspect,
|
25
|
+
:error => result.stderr
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
19
29
|
end
|
20
30
|
|
21
31
|
@app.call(env)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Vagrant
|
2
|
-
|
2
|
+
module Action
|
3
3
|
module VM
|
4
4
|
class Destroy
|
5
5
|
def initialize(app, env)
|
@@ -7,9 +7,9 @@ module Vagrant
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def call(env)
|
10
|
-
env
|
11
|
-
env[
|
12
|
-
env[
|
10
|
+
env[:ui].info I18n.t("vagrant.actions.vm.destroy.destroying")
|
11
|
+
env[:vm].driver.delete
|
12
|
+
env[:vm].uuid = nil
|
13
13
|
|
14
14
|
@app.call(env)
|
15
15
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Vagrant
|
2
|
-
|
2
|
+
module Action
|
3
3
|
module VM
|
4
4
|
# Destroys the unused host only interfaces. This middleware cleans
|
5
5
|
# up any created host only networks.
|
@@ -9,17 +9,7 @@ module Vagrant
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def call(env)
|
12
|
-
|
13
|
-
VirtualBox::Global.global(true).host.network_interfaces.each do |iface|
|
14
|
-
# We only care about host only interfaces
|
15
|
-
next if iface.interface_type != :host_only
|
16
|
-
|
17
|
-
# Destroy it if there is nothing attached
|
18
|
-
if iface.attached_vms.empty?
|
19
|
-
env.ui.info I18n.t("vagrant.actions.vm.destroy_network.destroying")
|
20
|
-
iface.destroy
|
21
|
-
end
|
22
|
-
end
|
12
|
+
env[:vm].driver.delete_unused_host_only_networks
|
23
13
|
|
24
14
|
# Continue along
|
25
15
|
@app.call(env)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Vagrant
|
2
|
-
|
2
|
+
module Action
|
3
3
|
module VM
|
4
4
|
# Discards the saved state of the VM if its saved. If its
|
5
5
|
# not saved, does nothing.
|
@@ -9,9 +9,9 @@ module Vagrant
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def call(env)
|
12
|
-
if env[
|
13
|
-
env
|
14
|
-
env[
|
12
|
+
if env[:vm].state == :saved
|
13
|
+
env[:ui].info I18n.t("vagrant.actions.vm.discard_state.discarding")
|
14
|
+
env[:vm].driver.discard_saved_state
|
15
15
|
end
|
16
16
|
|
17
17
|
@app.call(env)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
3
|
module Vagrant
|
4
|
-
|
4
|
+
module Action
|
5
5
|
module VM
|
6
6
|
class Export
|
7
7
|
attr_reader :temp_dir
|
@@ -14,7 +14,7 @@ module Vagrant
|
|
14
14
|
def call(env)
|
15
15
|
@env = env
|
16
16
|
|
17
|
-
raise Errors::VMPowerOffToPackage if
|
17
|
+
raise Errors::VMPowerOffToPackage if @env["vm"].state != :poweroff
|
18
18
|
|
19
19
|
setup_temp_dir
|
20
20
|
export
|
@@ -31,20 +31,25 @@ module Vagrant
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def setup_temp_dir
|
34
|
-
@env
|
35
|
-
@temp_dir = @env["export.temp_dir"] = @env
|
34
|
+
@env[:ui].info I18n.t("vagrant.actions.vm.export.create_dir")
|
35
|
+
@temp_dir = @env["export.temp_dir"] = @env[:tmp_path].join(Time.now.to_i.to_s)
|
36
36
|
FileUtils.mkpath(@env["export.temp_dir"])
|
37
37
|
end
|
38
38
|
|
39
39
|
def export
|
40
|
-
@env
|
41
|
-
@env[
|
42
|
-
@env
|
40
|
+
@env[:ui].info I18n.t("vagrant.actions.vm.export.exporting")
|
41
|
+
@env[:vm].driver.export(ovf_path) do |progress|
|
42
|
+
@env[:ui].clear_line
|
43
|
+
@env[:ui].report_progress(progress.percent, 100, false)
|
43
44
|
end
|
45
|
+
|
46
|
+
# Clear the line a final time so the next data can appear
|
47
|
+
# alone on the line.
|
48
|
+
@env[:ui].clear_line
|
44
49
|
end
|
45
50
|
|
46
51
|
def ovf_path
|
47
|
-
File.join(@env["export.temp_dir"],
|
52
|
+
File.join(@env["export.temp_dir"], "box.ovf")
|
48
53
|
end
|
49
54
|
end
|
50
55
|
end
|
@@ -1,134 +1,87 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'forward_ports_helpers')
|
2
|
-
|
3
1
|
module Vagrant
|
4
|
-
|
2
|
+
module Action
|
5
3
|
module VM
|
6
4
|
class ForwardPorts
|
7
|
-
include ForwardPortsHelpers
|
8
|
-
|
9
5
|
def initialize(app,env)
|
10
6
|
@app = app
|
11
|
-
@env = env
|
12
|
-
|
13
|
-
threshold_check
|
14
|
-
external_collision_check
|
15
7
|
end
|
16
8
|
|
17
9
|
#--------------------------------------------------------------
|
18
|
-
#
|
19
|
-
# executing the action
|
10
|
+
# Execution
|
20
11
|
#--------------------------------------------------------------
|
12
|
+
def call(env)
|
13
|
+
@env = env
|
21
14
|
|
22
|
-
|
23
|
-
|
24
|
-
def threshold_check
|
25
|
-
@env.env.config.vm.forwarded_ports.each do |name, options|
|
26
|
-
if options[:hostport] <= 1024
|
27
|
-
@env.ui.warn I18n.t("vagrant.actions.vm.forward_ports.privileged_ports")
|
28
|
-
return
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
15
|
+
# Get the ports we're forwarding
|
16
|
+
ports = forward_port_definitions
|
32
17
|
|
33
|
-
|
34
|
-
|
35
|
-
# report the collisions detected or will attempt to fix them
|
36
|
-
# automatically if the port is configured to do so.
|
37
|
-
def external_collision_check
|
38
|
-
existing = used_ports
|
39
|
-
@env.env.config.vm.forwarded_ports.each do |name, options|
|
40
|
-
if existing.include?(options[:hostport].to_i)
|
41
|
-
handle_collision(name, options, existing)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
18
|
+
# Warn if we're port forwarding to any privileged ports...
|
19
|
+
threshold_check(ports)
|
45
20
|
|
46
|
-
|
47
|
-
|
48
|
-
# auto fixing is disabled.
|
49
|
-
def handle_collision(name, options, existing_ports)
|
50
|
-
if !options[:auto]
|
51
|
-
# Auto fixing is disabled for this port forward, so we
|
52
|
-
# must throw an error so the user can fix it.
|
53
|
-
raise Errors::ForwardPortCollision, :name => name,
|
54
|
-
:host_port => options[:hostport].to_s,
|
55
|
-
:guest_port => options[:guestport].to_s
|
56
|
-
end
|
21
|
+
env[:ui].info I18n.t("vagrant.actions.vm.forward_ports.forwarding")
|
22
|
+
forward_ports(ports)
|
57
23
|
|
58
|
-
|
59
|
-
|
60
|
-
# left with available ports.
|
61
|
-
range = @env.env.config.vm.auto_port_range.to_a
|
62
|
-
range -= @env.env.config.vm.forwarded_ports.collect { |n, o| o[:hostport].to_i }
|
63
|
-
range -= existing_ports
|
24
|
+
@app.call(env)
|
25
|
+
end
|
64
26
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
27
|
+
# This returns an array of forwarded ports with overrides properly
|
28
|
+
# squashed.
|
29
|
+
def forward_port_definitions
|
30
|
+
# Get all the port mappings in the order they're defined and
|
31
|
+
# organize them by their guestport, taking the "last one wins"
|
32
|
+
# approach.
|
33
|
+
guest_port_mapping = {}
|
34
|
+
@env[:vm].config.vm.forwarded_ports.each do |options|
|
35
|
+
guest_port_mapping[options[:guestport]] = options
|
70
36
|
end
|
71
37
|
|
72
|
-
#
|
73
|
-
|
74
|
-
options[:hostport] = range.shift
|
75
|
-
existing_ports << options[:hostport]
|
76
|
-
|
77
|
-
# Notify the user
|
78
|
-
@env.ui.info(I18n.t("vagrant.actions.vm.forward_ports.fixed_collision",
|
79
|
-
:name => name,
|
80
|
-
:new_port => options[:hostport]))
|
38
|
+
# Return the values, since the order doesn't really matter
|
39
|
+
guest_port_mapping.values
|
81
40
|
end
|
82
41
|
|
83
|
-
|
84
|
-
#
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
forward_ports(vm)
|
42
|
+
# This method checks for any forwarded ports on the host below
|
43
|
+
# 1024, which causes the forwarded ports to fail.
|
44
|
+
def threshold_check(ports)
|
45
|
+
ports.each do |options|
|
46
|
+
if options[:hostport] <= 1024
|
47
|
+
@env[:ui].warn I18n.t("vagrant.actions.vm.forward_ports.privileged_ports")
|
48
|
+
return
|
49
|
+
end
|
92
50
|
end
|
93
|
-
|
94
|
-
env["vm.modify"].call(proc)
|
95
|
-
@app.call(env)
|
96
51
|
end
|
97
52
|
|
98
|
-
def forward_ports(
|
99
|
-
|
100
|
-
|
53
|
+
def forward_ports(mappings)
|
54
|
+
ports = []
|
55
|
+
|
56
|
+
interfaces = @env[:vm].driver.read_network_interfaces
|
57
|
+
|
58
|
+
mappings.each do |options|
|
101
59
|
message_attributes = {
|
102
|
-
:name => name,
|
103
60
|
:guest_port => options[:guestport],
|
104
61
|
:host_port => options[:hostport],
|
105
|
-
:adapter => adapter
|
62
|
+
:adapter => options[:adapter]
|
106
63
|
}
|
107
64
|
|
108
|
-
# Assuming the only reason to establish port forwarding is
|
109
|
-
#
|
110
|
-
#
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
65
|
+
# Assuming the only reason to establish port forwarding is
|
66
|
+
# because the VM is using Virtualbox NAT networking. Host-only
|
67
|
+
# bridged networking don't require port-forwarding and establishing
|
68
|
+
# forwarded ports on these attachment types has uncertain behaviour.
|
69
|
+
@env[:ui].info(I18n.t("vagrant.actions.vm.forward_ports.forwarding_entry",
|
70
|
+
message_attributes))
|
71
|
+
|
72
|
+
# Port forwarding requires the network interface to be a NAT interface,
|
73
|
+
# so verify that that is the case.
|
74
|
+
if interfaces[options[:adapter]][:type] != :nat
|
75
|
+
@env[:ui].info(I18n.t("vagrant.actions.vm.forward_ports.non_nat",
|
76
|
+
message_attributes))
|
77
|
+
next
|
116
78
|
end
|
117
|
-
end
|
118
|
-
end
|
119
79
|
|
120
|
-
|
121
|
-
|
122
|
-
|
80
|
+
# Add the options to the ports array to send to the driver later
|
81
|
+
ports << options.merge(:name => options[:name], :adapter => options[:adapter])
|
82
|
+
end
|
123
83
|
|
124
|
-
|
125
|
-
def forward_port(vm, name, options)
|
126
|
-
port = VirtualBox::NATForwardedPort.new
|
127
|
-
port.name = name
|
128
|
-
port.guestport = options[:guestport]
|
129
|
-
port.hostport = options[:hostport]
|
130
|
-
port.protocol = options[:protocol] || :tcp
|
131
|
-
vm.network_adapters[options[:adapter]].nat_driver.forwarded_ports << port
|
84
|
+
@env[:vm].driver.forward_ports(ports)
|
132
85
|
end
|
133
86
|
end
|
134
87
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Vagrant
|
2
|
-
|
2
|
+
module Action
|
3
3
|
module VM
|
4
4
|
class Halt
|
5
5
|
def initialize(app, env, options=nil)
|
@@ -8,12 +8,15 @@ module Vagrant
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def call(env)
|
11
|
-
if env[
|
12
|
-
|
11
|
+
if env[:vm].state == :running
|
12
|
+
if !env["force"]
|
13
|
+
env[:ui].info I18n.t("vagrant.actions.vm.halt.graceful")
|
14
|
+
env[:vm].guest.halt
|
15
|
+
end
|
13
16
|
|
14
|
-
if env[
|
15
|
-
env
|
16
|
-
env[
|
17
|
+
if env[:vm].state != :poweroff
|
18
|
+
env[:ui].info I18n.t("vagrant.actions.vm.halt.force")
|
19
|
+
env[:vm].driver.halt
|
17
20
|
end
|
18
21
|
|
19
22
|
# Sleep for a second to verify that the VM properly
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Vagrant
|
2
|
-
|
2
|
+
module Action
|
3
3
|
module VM
|
4
4
|
class HostName
|
5
5
|
def initialize(app, env)
|
@@ -9,10 +9,10 @@ module Vagrant
|
|
9
9
|
def call(env)
|
10
10
|
@app.call(env)
|
11
11
|
|
12
|
-
host_name = env[
|
12
|
+
host_name = env[:vm].config.vm.host_name
|
13
13
|
if !host_name.nil?
|
14
|
-
env
|
15
|
-
env[
|
14
|
+
env[:ui].info I18n.t("vagrant.actions.vm.host_name.setting")
|
15
|
+
env[:vm].guest.change_host_name(host_name)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Vagrant
|
2
|
-
|
2
|
+
module Action
|
3
3
|
module VM
|
4
4
|
class Import
|
5
5
|
def initialize(app, env)
|
@@ -7,31 +7,40 @@ module Vagrant
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def call(env)
|
10
|
-
env
|
10
|
+
env[:ui].info I18n.t("vagrant.actions.vm.import.importing", :name => env[:vm].box.name)
|
11
11
|
|
12
12
|
# Import the virtual machine
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
name = File.basename(env[:vm].env.cwd) + "_#{Time.now.to_i}"
|
14
|
+
ovf_file = env[:vm].box.directory.join("box.ovf").to_s
|
15
|
+
env[:vm].uuid = env[:vm].driver.import(ovf_file, name) do |progress|
|
16
|
+
env[:ui].clear_line
|
17
|
+
env[:ui].report_progress(progress, 100, false)
|
16
18
|
end
|
17
19
|
|
18
20
|
# Clear the line one last time since the progress meter doesn't disappear
|
19
21
|
# immediately.
|
20
|
-
env
|
22
|
+
env[:ui].clear_line
|
23
|
+
|
24
|
+
# If we got interrupted, then the import could have been
|
25
|
+
# interrupted and its not a big deal. Just return out.
|
26
|
+
return if env[:interrupted]
|
21
27
|
|
22
28
|
# Flag as erroneous and return if import failed
|
23
|
-
raise Errors::VMImportFailure if !env[
|
29
|
+
raise Errors::VMImportFailure if !env[:vm].uuid
|
24
30
|
|
25
31
|
# Import completed successfully. Continue the chain
|
26
32
|
@app.call(env)
|
27
33
|
end
|
28
34
|
|
29
35
|
def recover(env)
|
30
|
-
if env[
|
36
|
+
if env[:vm].created?
|
31
37
|
return if env["vagrant.error"].is_a?(Errors::VagrantError)
|
32
38
|
|
33
|
-
# Interrupted, destroy the VM
|
34
|
-
|
39
|
+
# Interrupted, destroy the VM. We note that we don't want to
|
40
|
+
# validate the configuration here.
|
41
|
+
destroy_env = env.clone
|
42
|
+
destroy_env[:validate] = false
|
43
|
+
env[:action_runner].run(:destroy, destroy_env)
|
35
44
|
end
|
36
45
|
end
|
37
46
|
end
|