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
@@ -1,5 +1,5 @@
|
|
1
1
|
module Vagrant
|
2
|
-
|
2
|
+
module Action
|
3
3
|
module VM
|
4
4
|
class MatchMACAddress
|
5
5
|
def initialize(app, env)
|
@@ -7,16 +7,11 @@ module Vagrant
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def call(env)
|
10
|
-
raise Errors::VMBaseMacNotSpecified if !env.
|
10
|
+
raise Errors::VMBaseMacNotSpecified if !env[:vm].config.vm.base_mac
|
11
11
|
|
12
12
|
# Create the proc which we want to use to modify the virtual machine
|
13
|
-
|
14
|
-
|
15
|
-
vm.network_adapters.first.mac_address = env["config"].vm.base_mac
|
16
|
-
end
|
17
|
-
|
18
|
-
# Add the proc to the modification chain
|
19
|
-
env["vm.modify"].call(proc)
|
13
|
+
env[:ui].info I18n.t("vagrant.actions.vm.match_mac.matching")
|
14
|
+
env[:vm].driver.set_mac_address(env[:vm].config.vm.base_mac)
|
20
15
|
|
21
16
|
@app.call(env)
|
22
17
|
end
|
@@ -1,144 +1,350 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
3
|
+
require 'log4r'
|
4
|
+
|
5
|
+
require 'vagrant/util/network_ip'
|
6
|
+
|
1
7
|
module Vagrant
|
2
|
-
|
8
|
+
module Action
|
3
9
|
module VM
|
4
|
-
#
|
5
|
-
#
|
10
|
+
# This action handles all `config.vm.network` configurations by
|
11
|
+
# setting up the VM properly and enabling the networks afterword.
|
6
12
|
class Network
|
13
|
+
# Utilities to deal with network addresses
|
14
|
+
include Util::NetworkIP
|
15
|
+
|
7
16
|
def initialize(app, env)
|
17
|
+
@logger = Log4r::Logger.new("vagrant::action::vm::network")
|
18
|
+
|
8
19
|
@app = app
|
20
|
+
end
|
21
|
+
|
22
|
+
def call(env)
|
9
23
|
@env = env
|
10
24
|
|
11
|
-
|
12
|
-
|
25
|
+
# First we have to get the array of adapters that we need
|
26
|
+
# to create on the virtual machine itself, as well as the
|
27
|
+
# driver-agnostic network configurations for each.
|
28
|
+
@logger.debug("Determining adapters and networks...")
|
29
|
+
adapters = []
|
30
|
+
networks = []
|
31
|
+
env[:vm].config.vm.networks.each do |type, args|
|
32
|
+
# Get the normalized configuration we'll use around
|
33
|
+
config = send("#{type}_config", args)
|
34
|
+
|
35
|
+
# Get the virtualbox adapter configuration
|
36
|
+
adapter = send("#{type}_adapter", config)
|
37
|
+
adapters << adapter
|
38
|
+
|
39
|
+
# Get the network configuration
|
40
|
+
network = send("#{type}_network_config", config)
|
41
|
+
networks << network
|
13
42
|
end
|
14
43
|
|
15
|
-
|
16
|
-
|
44
|
+
if !adapters.empty?
|
45
|
+
# Automatically assign an adapter number to any adapters
|
46
|
+
# that aren't explicitly set.
|
47
|
+
@logger.debug("Assigning adapter locations...")
|
48
|
+
assign_adapter_locations(adapters)
|
49
|
+
|
50
|
+
# Verify that our adapters are good just prior to enabling them.
|
51
|
+
verify_adapters(adapters)
|
52
|
+
|
53
|
+
# Create all the network interfaces
|
54
|
+
@logger.info("Enabling adapters...")
|
55
|
+
env[:ui].info I18n.t("vagrant.actions.vm.network.preparing")
|
56
|
+
env[:vm].driver.enable_adapters(adapters)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Continue the middleware chain. We're done with our VM
|
60
|
+
# setup until after it is booted.
|
61
|
+
@app.call(env)
|
62
|
+
|
63
|
+
if !adapters.empty?
|
64
|
+
# Determine the interface numbers for the guest.
|
65
|
+
assign_interface_numbers(networks, adapters)
|
66
|
+
|
67
|
+
# Configure all the network interfaces on the guest.
|
68
|
+
env[:ui].info I18n.t("vagrant.actions.vm.network.configuring")
|
69
|
+
env[:vm].guest.configure_networks(networks)
|
17
70
|
end
|
18
71
|
end
|
19
72
|
|
20
|
-
|
21
|
-
|
22
|
-
|
73
|
+
# This method assigns the adapter to use for the adapter.
|
74
|
+
# e.g. it says that the first adapter is actually on the
|
75
|
+
# virtual machine's 2nd adapter location.
|
76
|
+
#
|
77
|
+
# It determines the adapter numbers by simply finding the
|
78
|
+
# "next available" in each case.
|
79
|
+
#
|
80
|
+
# The adapters are modified in place by adding an ":adapter"
|
81
|
+
# field to each.
|
82
|
+
def assign_adapter_locations(adapters)
|
83
|
+
available = Set.new(1..8)
|
23
84
|
|
24
|
-
|
85
|
+
# Determine which NICs are actually available.
|
86
|
+
interfaces = @env[:vm].driver.read_network_interfaces
|
87
|
+
interfaces.each do |number, nic|
|
88
|
+
# Remove the number from the available NICs if the
|
89
|
+
# NIC is in use.
|
90
|
+
available.delete(number) if nic[:type] != :none
|
91
|
+
end
|
25
92
|
|
26
|
-
|
27
|
-
|
93
|
+
# Based on the available set, assign in order to
|
94
|
+
# the adapters.
|
95
|
+
available = available.to_a.sort
|
96
|
+
@logger.debug("Available NICs: #{available.inspect}")
|
97
|
+
adapters.each do |adapter|
|
98
|
+
# Ignore the adapters that already have been assigned
|
99
|
+
if !adapter[:adapter]
|
100
|
+
# If we have no available adapters, then that is an exceptional
|
101
|
+
# event.
|
102
|
+
raise Errors::NetworkNoAdapters if available.empty?
|
28
103
|
|
29
|
-
|
30
|
-
|
31
|
-
options.each do |network_options|
|
32
|
-
@env["vm"].system.prepare_host_only_network(network_options)
|
104
|
+
# Otherwise, assign as the adapter the next available item
|
105
|
+
adapter[:adapter] = available.shift
|
33
106
|
end
|
107
|
+
end
|
108
|
+
end
|
34
109
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
110
|
+
# Verifies that the adapter configurations look good. This will
|
111
|
+
# raise an exception in the case that any errors occur.
|
112
|
+
def verify_adapters(adapters)
|
113
|
+
# Verify that there are no collisions in the adapters being used.
|
114
|
+
used = Set.new
|
115
|
+
adapters.each do |adapter|
|
116
|
+
raise Errors::NetworkAdapterCollision if used.include?(adapter[:adapter])
|
117
|
+
used.add(adapter[:adapter])
|
39
118
|
end
|
40
119
|
end
|
41
120
|
|
42
|
-
#
|
43
|
-
#
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
121
|
+
# Assigns the actual interface number of a network based on the
|
122
|
+
# enabled NICs on the virtual machine.
|
123
|
+
#
|
124
|
+
# This interface number is used by the guest to configure the
|
125
|
+
# NIC on the guest VM.
|
126
|
+
#
|
127
|
+
# The networks are modified in place by adding an ":interface"
|
128
|
+
# field to each.
|
129
|
+
def assign_interface_numbers(networks, adapters)
|
130
|
+
current = 0
|
131
|
+
adapter_to_interface = {}
|
48
132
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
133
|
+
# Make a first pass to assign interface numbers by adapter location
|
134
|
+
vm_adapters = @env[:vm].driver.read_network_interfaces
|
135
|
+
vm_adapters.each do |number, adapter|
|
136
|
+
if adapter[:type] != :none
|
137
|
+
# Not used, so assign the interface number and increment
|
138
|
+
adapter_to_interface[number] = current
|
139
|
+
current += 1
|
53
140
|
end
|
54
|
-
|
55
|
-
return false if result
|
56
141
|
end
|
57
142
|
|
58
|
-
|
59
|
-
|
143
|
+
# Make a pass through the adapters to assign the :interface
|
144
|
+
# key to each network configuration.
|
145
|
+
adapters.each_index do |i|
|
146
|
+
adapter = adapters[i]
|
147
|
+
network = networks[i]
|
60
148
|
|
61
|
-
|
62
|
-
|
149
|
+
# Figure out the interface number by simple lookup
|
150
|
+
network[:interface] = adapter_to_interface[adapter[:adapter]]
|
151
|
+
end
|
63
152
|
end
|
64
153
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
154
|
+
def hostonly_config(args)
|
155
|
+
ip = args[0]
|
156
|
+
options = args[1] || {}
|
157
|
+
|
158
|
+
# Determine if we're dealing with a static IP or a DHCP-served IP.
|
159
|
+
type = ip == :dhcp ? :dhcp : :static
|
160
|
+
|
161
|
+
# Default IP is in the 20-bit private network block for DHCP based networks
|
162
|
+
ip = "172.28.128.1" if type == :dhcp
|
163
|
+
|
164
|
+
options = {
|
165
|
+
:type => type,
|
166
|
+
:ip => ip,
|
167
|
+
:netmask => "255.255.255.0",
|
168
|
+
:adapter => nil,
|
169
|
+
:mac => nil,
|
170
|
+
:name => nil
|
171
|
+
}.merge(options)
|
172
|
+
|
173
|
+
# Verify that this hostonly network wouldn't conflict with any
|
174
|
+
# bridged interfaces
|
175
|
+
verify_no_bridge_collision(options)
|
176
|
+
|
177
|
+
# Get the network address and IP parts which are used for many
|
178
|
+
# default calculations
|
179
|
+
netaddr = network_address(options[:ip], options[:netmask])
|
180
|
+
ip_parts = netaddr.split(".").map { |i| i.to_i }
|
181
|
+
|
182
|
+
# Calculate the adapter IP, which we assume is the IP ".1" at the
|
183
|
+
# end usually.
|
184
|
+
adapter_ip = ip_parts.dup
|
185
|
+
adapter_ip[3] += 1
|
186
|
+
options[:adapter_ip] ||= adapter_ip.join(".")
|
187
|
+
|
188
|
+
if type == :dhcp
|
189
|
+
# Calculate the DHCP server IP, which is the network address
|
190
|
+
# with the final octet + 2. So "172.28.0.0" turns into "172.28.0.2"
|
191
|
+
dhcp_ip = ip_parts.dup
|
192
|
+
dhcp_ip[3] += 2
|
193
|
+
options[:dhcp_ip] ||= dhcp_ip.join(".")
|
194
|
+
|
195
|
+
# Calculate the lower and upper bound for the DHCP server
|
196
|
+
dhcp_lower = ip_parts.dup
|
197
|
+
dhcp_lower[3] += 3
|
198
|
+
options[:dhcp_lower] ||= dhcp_lower.join(".")
|
199
|
+
|
200
|
+
dhcp_upper = ip_parts.dup
|
201
|
+
dhcp_upper[3] = 254
|
202
|
+
options[:dhcp_upper] ||= dhcp_upper.join(".")
|
77
203
|
end
|
204
|
+
|
205
|
+
# Return the hostonly network configuration
|
206
|
+
return options
|
78
207
|
end
|
79
208
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
#
|
88
|
-
#
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
209
|
+
def hostonly_adapter(config)
|
210
|
+
@logger.debug("Searching for matching network: #{config[:ip]}")
|
211
|
+
interface = find_matching_hostonly_network(config)
|
212
|
+
|
213
|
+
if !interface
|
214
|
+
@logger.debug("Network not found. Creating if we can.")
|
215
|
+
|
216
|
+
# It is an error case if a specific name was given but the network
|
217
|
+
# doesn't exist.
|
218
|
+
if config[:name]
|
219
|
+
raise Errors::NetworkNotFound, :name => config[:name]
|
220
|
+
end
|
221
|
+
|
222
|
+
# Otherwise, we create a new network and put the net network
|
223
|
+
# in the list of available networks so other network definitions
|
224
|
+
# can use it!
|
225
|
+
interface = create_hostonly_network(config)
|
226
|
+
@logger.debug("Created network: #{interface[:name]}")
|
227
|
+
end
|
228
|
+
|
229
|
+
if config[:type] == :dhcp
|
230
|
+
# Check that if there is a DHCP server attached on our interface,
|
231
|
+
# then it is identical. Otherwise, we can't set it.
|
232
|
+
if interface[:dhcp]
|
233
|
+
valid = interface[:dhcp][:ip] == config[:dhcp_ip] &&
|
234
|
+
interface[:dhcp][:lower] == config[:dhcp_lower] &&
|
235
|
+
interface[:dhcp][:upper] == config[:dhcp_upper]
|
236
|
+
|
237
|
+
raise Errors::NetworkDHCPAlreadyAttached if !valid
|
238
|
+
|
239
|
+
@logger.debug("DHCP server already properly configured")
|
93
240
|
else
|
94
|
-
|
241
|
+
# Configure the DHCP server for the network.
|
242
|
+
@logger.debug("Creating a DHCP server...")
|
243
|
+
@env[:vm].driver.create_dhcp_server(interface[:name], config)
|
95
244
|
end
|
96
245
|
end
|
97
246
|
|
98
|
-
|
247
|
+
return {
|
248
|
+
:adapter => config[:adapter],
|
249
|
+
:type => :hostonly,
|
250
|
+
:hostonly => interface[:name],
|
251
|
+
:mac_address => config[:mac]
|
252
|
+
}
|
253
|
+
end
|
254
|
+
|
255
|
+
def hostonly_network_config(config)
|
256
|
+
return {
|
257
|
+
:type => config[:type],
|
258
|
+
:ip => config[:ip],
|
259
|
+
:netmask => config[:netmask]
|
260
|
+
}
|
261
|
+
end
|
99
262
|
|
100
|
-
|
101
|
-
|
263
|
+
# Creates a new hostonly network that matches the network requested
|
264
|
+
# by the given host-only network configuration.
|
265
|
+
def create_hostonly_network(config)
|
266
|
+
# Create the options that are going to be used to create our
|
267
|
+
# new network.
|
268
|
+
options = config.dup
|
269
|
+
options[:ip] = options[:adapter_ip]
|
102
270
|
|
103
|
-
|
104
|
-
ni.enable_static(network_ip(net_options[:ip], net_options[:netmask]),
|
105
|
-
net_options[:netmask])
|
106
|
-
ni.name
|
271
|
+
@env[:vm].driver.create_host_only_network(options)
|
107
272
|
end
|
108
273
|
|
109
|
-
#
|
110
|
-
#
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
274
|
+
# Finds a host only network that matches our configuration on VirtualBox.
|
275
|
+
# This will return nil if a matching network does not exist.
|
276
|
+
def find_matching_hostonly_network(config)
|
277
|
+
this_netaddr = network_address(config[:ip], config[:netmask])
|
278
|
+
|
279
|
+
@env[:vm].driver.read_host_only_interfaces.each do |interface|
|
280
|
+
if config[:name] && config[:name] == interface[:name]
|
281
|
+
return interface
|
282
|
+
elsif this_netaddr == network_address(interface[:ip], interface[:netmask])
|
283
|
+
return interface
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
nil
|
116
288
|
end
|
117
289
|
|
118
|
-
#
|
119
|
-
#
|
120
|
-
|
121
|
-
|
122
|
-
|
290
|
+
# Verifies that a host-only network subnet would not collide with
|
291
|
+
# a bridged networking interface.
|
292
|
+
#
|
293
|
+
# If the subnets overlap in any way then the host only network
|
294
|
+
# will not work because the routing tables will force the traffic
|
295
|
+
# onto the real interface rather than the virtualbox interface.
|
296
|
+
def verify_no_bridge_collision(options)
|
297
|
+
this_netaddr = network_address(options[:ip], options[:netmask])
|
123
298
|
|
124
|
-
|
125
|
-
|
299
|
+
@env[:vm].driver.read_bridged_interfaces.each do |interface|
|
300
|
+
that_netaddr = network_address(interface[:ip], interface[:netmask])
|
301
|
+
raise Errors::NetworkCollision if this_netaddr == that_netaddr
|
126
302
|
end
|
127
303
|
end
|
128
304
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
305
|
+
def bridged_config(args)
|
306
|
+
options = args[0] || {}
|
307
|
+
|
308
|
+
return {
|
309
|
+
:adapter => nil,
|
310
|
+
:mac => nil
|
311
|
+
}.merge(options)
|
312
|
+
end
|
313
|
+
|
314
|
+
def bridged_adapter(config)
|
315
|
+
bridgedifs = @env[:vm].driver.read_bridged_interfaces
|
316
|
+
|
317
|
+
# Output all the interfaces that are available as choices
|
318
|
+
@env[:ui].info I18n.t("vagrant.actions.vm.bridged_networking.available",
|
319
|
+
:prefix => false)
|
320
|
+
bridgedifs.each_index do |index|
|
321
|
+
interface = bridgedifs[index]
|
322
|
+
@env[:ui].info("#{index + 1}) #{interface[:name]}", :prefix => false)
|
133
323
|
end
|
324
|
+
|
325
|
+
# The range of valid choices
|
326
|
+
valid = Range.new(1, bridgedifs.length)
|
327
|
+
|
328
|
+
# The choice that the user has chosen as the bridging interface
|
329
|
+
choice = nil
|
330
|
+
while !valid.include?(choice)
|
331
|
+
choice = @env[:ui].ask("What interface should the network bridge to? ")
|
332
|
+
choice = choice.to_i
|
333
|
+
end
|
334
|
+
|
335
|
+
# Given the choice we can now define the adapter we're using
|
336
|
+
return {
|
337
|
+
:adapter => config[:adapter],
|
338
|
+
:type => :bridged,
|
339
|
+
:bridge => bridgedifs[choice - 1][:name],
|
340
|
+
:mac_address => config[:mac]
|
341
|
+
}
|
134
342
|
end
|
135
343
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
parts[3] += 1;
|
141
|
-
parts.join(".")
|
344
|
+
def bridged_network_config(config)
|
345
|
+
return {
|
346
|
+
:type => :dhcp
|
347
|
+
}
|
142
348
|
end
|
143
349
|
end
|
144
350
|
end
|
@@ -1,7 +1,5 @@
|
|
1
|
-
require File.expand_path("../nfs_helpers", __FILE__)
|
2
|
-
|
3
1
|
module Vagrant
|
4
|
-
|
2
|
+
module Action
|
5
3
|
module VM
|
6
4
|
# Enables NFS based shared folders. `nfsd` must already be installed
|
7
5
|
# on the host machine, and NFS client must already be installed on
|
@@ -16,8 +14,6 @@ module Vagrant
|
|
16
14
|
# folder.
|
17
15
|
#
|
18
16
|
class NFS
|
19
|
-
include NFSHelpers
|
20
|
-
|
21
17
|
def initialize(app,env)
|
22
18
|
@app = app
|
23
19
|
@env = env
|
@@ -32,7 +28,6 @@ module Vagrant
|
|
32
28
|
|
33
29
|
if !folders.empty?
|
34
30
|
prepare_folders
|
35
|
-
clear_nfs_exports(env)
|
36
31
|
export_folders
|
37
32
|
end
|
38
33
|
|
@@ -42,7 +37,12 @@ module Vagrant
|
|
42
37
|
end
|
43
38
|
|
44
39
|
def recover(env)
|
45
|
-
|
40
|
+
# Ignore any VagrantErrors, because they were expected and
|
41
|
+
# will cause the VM to stick around.
|
42
|
+
return if env["vagrant.error"].is_a?(Errors::VagrantError)
|
43
|
+
|
44
|
+
# Otherwise, clear the NFS exports.
|
45
|
+
clear_nfs_exports(env)
|
46
46
|
end
|
47
47
|
|
48
48
|
# Returns the folders which are to be synced via NFS.
|
@@ -55,14 +55,14 @@ module Vagrant
|
|
55
55
|
# task.
|
56
56
|
def extract_folders
|
57
57
|
# Load the NFS enabled shared folders
|
58
|
-
@folders = @env[
|
58
|
+
@folders = @env[:vm].config.vm.shared_folders.inject({}) do |acc, data|
|
59
59
|
key, opts = data
|
60
60
|
|
61
61
|
if opts[:nfs]
|
62
62
|
# Duplicate the options, set the hostpath, and set disabled on the original
|
63
63
|
# options so the ShareFolders middleware doesn't try to mount it.
|
64
64
|
acc[key] = opts.dup
|
65
|
-
acc[key][:hostpath] = File.expand_path(opts[:hostpath], @env
|
65
|
+
acc[key][:hostpath] = File.expand_path(opts[:hostpath], @env[:root_path])
|
66
66
|
opts[:disabled] = true
|
67
67
|
end
|
68
68
|
|
@@ -91,7 +91,7 @@ module Vagrant
|
|
91
91
|
|
92
92
|
# The options on the hash get priority, then the default
|
93
93
|
# values
|
94
|
-
value = opts.has_key?(key) ? opts[key] : @env[
|
94
|
+
value = opts.has_key?(key) ? opts[key] : @env[:vm].config.nfs.send(key)
|
95
95
|
return value if value != :auto
|
96
96
|
|
97
97
|
# Get UID/GID from folder if we've made it this far
|
@@ -104,31 +104,40 @@ module Vagrant
|
|
104
104
|
# involves adding a line to `/etc/exports` for this VM, but it is
|
105
105
|
# up to the host class to define the specific behavior.
|
106
106
|
def export_folders
|
107
|
-
@env
|
108
|
-
|
109
|
-
@env["host"].nfs_export(guest_ip, folders)
|
107
|
+
@env[:ui].info I18n.t("vagrant.actions.vm.nfs.exporting")
|
108
|
+
@env[:host].nfs_export(@env[:vm].uuid, guest_ip, folders)
|
110
109
|
end
|
111
110
|
|
112
111
|
# Uses the system class to mount the NFS folders.
|
113
112
|
def mount_folders
|
114
|
-
@env
|
113
|
+
@env[:ui].info I18n.t("vagrant.actions.vm.nfs.mounting")
|
115
114
|
|
116
115
|
# Only mount the folders which have a guest path specified
|
117
|
-
|
118
|
-
|
119
|
-
|
116
|
+
mount_folders = {}
|
117
|
+
folders.each do |name, opts|
|
118
|
+
if opts[:guestpath]
|
119
|
+
mount_folders[name] = opts.dup
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
@env[:vm].guest.mount_nfs(host_ip, mount_folders)
|
120
124
|
end
|
121
125
|
|
122
126
|
# Returns the IP address of the first host only network adapter
|
123
127
|
#
|
124
128
|
# @return [String]
|
125
129
|
def host_ip
|
126
|
-
|
127
|
-
|
130
|
+
@env[:vm].driver.read_network_interfaces.each do |adapter, opts|
|
131
|
+
if opts[:type] == :hostonly
|
132
|
+
@env[:vm].driver.read_host_only_interfaces.each do |interface|
|
133
|
+
if interface[:name] == opts[:hostonly]
|
134
|
+
return interface[:ip]
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
128
138
|
end
|
129
139
|
|
130
|
-
|
131
|
-
interface.host_interface_object.ip_address
|
140
|
+
nil
|
132
141
|
end
|
133
142
|
|
134
143
|
# Returns the IP address of the guest by looking at the first
|
@@ -136,12 +145,18 @@ module Vagrant
|
|
136
145
|
#
|
137
146
|
# @return [String]
|
138
147
|
def guest_ip
|
139
|
-
@env[
|
148
|
+
@env[:vm].config.vm.networks.each do |type, args|
|
149
|
+
if type == :hostonly && args[0].is_a?(String)
|
150
|
+
return args[0]
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
nil
|
140
155
|
end
|
141
156
|
|
142
157
|
# Checks if there are any NFS enabled shared folders.
|
143
158
|
def nfs_enabled?
|
144
|
-
@env[
|
159
|
+
@env[:vm].config.vm.shared_folders.each do |key, opts|
|
145
160
|
return true if opts[:nfs]
|
146
161
|
end
|
147
162
|
|
@@ -150,9 +165,9 @@ module Vagrant
|
|
150
165
|
|
151
166
|
# Verifies that the host is set and supports NFS.
|
152
167
|
def verify_settings
|
153
|
-
raise Errors::NFSHostRequired if @env[
|
154
|
-
raise Errors::NFSNotSupported if !@env[
|
155
|
-
raise Errors::NFSNoHostNetwork if
|
168
|
+
raise Errors::NFSHostRequired if @env[:host].nil?
|
169
|
+
raise Errors::NFSNotSupported if !@env[:host].nfs?
|
170
|
+
raise Errors::NFSNoHostNetwork if !guest_ip
|
156
171
|
end
|
157
172
|
end
|
158
173
|
end
|
@@ -1,9 +1,12 @@
|
|
1
|
+
require 'vagrant/util/template_renderer'
|
2
|
+
|
1
3
|
module Vagrant
|
2
|
-
|
4
|
+
module Action
|
3
5
|
module VM
|
4
6
|
# Puts a generated Vagrantfile into the package directory so that
|
5
7
|
# it can be included in the package.
|
6
8
|
class PackageVagrantfile
|
9
|
+
# For TemplateRenderer
|
7
10
|
include Util
|
8
11
|
|
9
12
|
def initialize(app, env)
|
@@ -23,7 +26,7 @@ module Vagrant
|
|
23
26
|
def create_vagrantfile
|
24
27
|
File.open(File.join(@env["export.temp_dir"], "Vagrantfile"), "w") do |f|
|
25
28
|
f.write(TemplateRenderer.render("package_Vagrantfile", {
|
26
|
-
:base_mac => @env["vm"].
|
29
|
+
:base_mac => @env["vm"].driver.read_mac_address
|
27
30
|
}))
|
28
31
|
end
|
29
32
|
end
|