vagrantup 0.6.9 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +37 -0
- data/Gemfile +0 -8
- data/README.md +5 -0
- data/config/default.rb +1 -3
- data/contrib/README.md +12 -0
- data/contrib/emacs/vagrant.el +8 -0
- data/contrib/vim/vagrantfile.vim +9 -0
- data/lib/vagrant/action/box/download.rb +0 -1
- data/lib/vagrant/action/box.rb +11 -0
- data/lib/vagrant/action/builtin.rb +1 -2
- data/lib/vagrant/action/env.rb +7 -0
- data/lib/vagrant/action/general.rb +8 -0
- data/lib/vagrant/action/vm/boot.rb +3 -2
- data/lib/vagrant/action/vm/check_box.rb +1 -0
- data/lib/vagrant/action/vm/clean_machine_folder.rb +1 -1
- data/lib/vagrant/action/vm/destroy.rb +1 -1
- data/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb +7 -12
- data/lib/vagrant/action/vm/network.rb +1 -1
- data/lib/vagrant/action/vm/nfs.rb +3 -1
- data/lib/vagrant/action/vm/provision.rb +14 -25
- data/lib/vagrant/action/vm/share_folders.rb +11 -4
- data/lib/vagrant/action/vm.rb +30 -0
- data/lib/vagrant/action.rb +12 -0
- data/lib/vagrant/command.rb +25 -0
- data/lib/vagrant/config/base.rb +17 -3
- data/lib/vagrant/config/ssh.rb +2 -2
- data/lib/vagrant/config/top.rb +61 -0
- data/lib/vagrant/config/vagrant.rb +1 -6
- data/lib/vagrant/config/vm/provisioner.rb +56 -0
- data/lib/vagrant/config/vm/sub_vm.rb +17 -0
- data/lib/vagrant/config/vm.rb +34 -20
- data/lib/vagrant/config.rb +78 -128
- data/lib/vagrant/downloaders/file.rb +1 -0
- data/lib/vagrant/downloaders/http.rb +9 -0
- data/lib/vagrant/downloaders.rb +7 -0
- data/lib/vagrant/environment.rb +26 -14
- data/lib/vagrant/errors.rb +5 -15
- data/lib/vagrant/hosts.rb +7 -0
- data/lib/vagrant/provisioners/base.rb +19 -1
- data/lib/vagrant/provisioners/chef.rb +31 -52
- data/lib/vagrant/provisioners/chef_server.rb +34 -10
- data/lib/vagrant/provisioners/chef_solo.rb +31 -9
- data/lib/vagrant/provisioners/puppet.rb +111 -60
- data/lib/vagrant/provisioners/puppet_server.rb +57 -0
- data/lib/vagrant/provisioners.rb +8 -0
- data/lib/vagrant/ssh/session.rb +81 -0
- data/lib/vagrant/ssh.rb +6 -76
- data/lib/vagrant/systems/base.rb +16 -1
- data/lib/vagrant/systems/debian.rb +26 -0
- data/lib/vagrant/systems/gentoo.rb +27 -0
- data/lib/vagrant/systems/linux/config.rb +21 -0
- data/lib/vagrant/systems/linux/error.rb +9 -0
- data/lib/vagrant/systems/linux.rb +14 -56
- data/lib/vagrant/systems/redhat.rb +31 -0
- data/lib/vagrant/systems.rb +9 -0
- data/lib/vagrant/test_helpers.rb +1 -1
- data/lib/vagrant/version.rb +1 -1
- data/lib/vagrant/vm.rb +25 -5
- data/lib/vagrant.rb +14 -18
- data/templates/chef_solo_solo.erb +11 -3
- data/templates/commands/init/Vagrantfile.erb +13 -11
- data/templates/locales/en.yml +76 -26
- data/templates/{network_entry.erb → network_entry_debian.erb} +0 -0
- data/templates/network_entry_gentoo.erb +7 -0
- data/templates/network_entry_redhat.erb +8 -0
- data/templates/ssh_config.erb +1 -1
- data/test/vagrant/action/vm/check_box_test.rb +1 -0
- data/test/vagrant/action/vm/clean_machine_folder_test.rb +6 -4
- data/test/vagrant/action/vm/destroy_test.rb +1 -1
- data/test/vagrant/action/vm/destroy_unused_network_interfaces_test.rb +10 -7
- data/test/vagrant/action/vm/nfs_test.rb +7 -1
- data/test/vagrant/action/vm/provision_test.rb +24 -79
- data/test/vagrant/action/vm/share_folders_test.rb +6 -1
- data/test/vagrant/command/helpers_test.rb +2 -2
- data/test/vagrant/config/base_test.rb +0 -6
- data/test/vagrant/config/vagrant_test.rb +0 -8
- data/test/vagrant/config/vm/provisioner_test.rb +92 -0
- data/test/vagrant/config/vm_test.rb +8 -0
- data/test/vagrant/config_test.rb +49 -89
- data/test/vagrant/downloaders/file_test.rb +18 -4
- data/test/vagrant/environment_test.rb +36 -12
- data/test/vagrant/provisioners/base_test.rb +28 -1
- data/test/vagrant/provisioners/chef_server_test.rb +50 -41
- data/test/vagrant/provisioners/chef_solo_test.rb +39 -16
- data/test/vagrant/provisioners/chef_test.rb +11 -81
- data/test/vagrant/provisioners/puppet_server_test.rb +69 -0
- data/test/vagrant/provisioners/puppet_test.rb +116 -69
- data/test/vagrant/{ssh_session_test.rb → ssh/session_test.rb} +0 -0
- data/test/vagrant/ssh_test.rb +20 -7
- data/test/vagrant/systems/base_test.rb +18 -0
- data/test/vagrant/systems/linux_test.rb +2 -2
- data/test/vagrant/vm_test.rb +33 -5
- data/vagrant.gemspec +6 -5
- metadata +38 -14
- data/lib/vagrant/action/vm/disable_networks.rb +0 -34
- data/lib/vagrant/util/glob_loader.rb +0 -24
- data/test/vagrant/action/vm/disable_networks_test.rb +0 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da71b97656f3724f4d8d6085e991f250652af507
|
4
|
+
data.tar.gz: 7db3b07b682baa725fbcb8b06e421bea4d3259e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 370cfe99493f05b73719eab98d9e2c14745bef71416c494c4875de15ca74cd52e8b70635fe081e97ba1c42b8a8d620f12e37b7610c77a7c82272d5eb3218c938
|
7
|
+
data.tar.gz: 0cbad4da87837a33015f07aabb07246d529ffb130e0dd74ffff7636fdd7035ccc2f08d591c9f1118c1705f05a030c7ed7696baf0369661809d9ae84937af8926
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,40 @@
|
|
1
|
+
## 0.7.0 (January 19, 2011)
|
2
|
+
|
3
|
+
- VirtualBox 4.0 support. Support for VirtualBox 3.2 is _dropped_, since
|
4
|
+
the API is so different. Stay with the 0.6.x series if you have VirtualBox
|
5
|
+
3.2.x.
|
6
|
+
- Puppet server provisioner. [GH-262]
|
7
|
+
- Use numeric uid/gid in mounting shared folders to increase portability. [GH-252]
|
8
|
+
- HTTP downloading follows redirects. [GH-163]
|
9
|
+
- Downloaders have clearer output to note what they're doing.
|
10
|
+
- Shared folders with no guest path are not automounted. [GH-184]
|
11
|
+
- Boxes downloaded during `vagrant up` reload the Vagrantfile config, which
|
12
|
+
fixes a problem with box settings not being properly loaded. [GH-231]
|
13
|
+
- `config.ssh.forward_x11` to enable the ForwardX11 SSH option. [GH-255]
|
14
|
+
- Vagrant source now has a `contrib` directory where contributions of miscellaneous
|
15
|
+
addons for Vagrant will be added.
|
16
|
+
- Vagrantfiles are now loaded only once (instead of 4+ times) [GH-238]
|
17
|
+
- Ability to move home vagrant dir (~/.vagrant) by setting VAGRANT_HOME
|
18
|
+
environmental variable.
|
19
|
+
- Removed check and error for the "OSE" version of VirtualBox, since with
|
20
|
+
VirtualBox 4 this distinction no longer exists.
|
21
|
+
- Ability to specify proxy settings for chef. [GH-169]
|
22
|
+
- Helpful error message shown if NFS mounting fails. [GH-135]
|
23
|
+
- Gentoo guests now support host only networks. [GH-240]
|
24
|
+
- RedHat (CentOS included) guests now support host only networks. [GH-260]
|
25
|
+
- New Vagrantfile syntax for enabling and configuring provisioners. This
|
26
|
+
change is not backwards compatible. [GH-265]
|
27
|
+
- Provisioners are now RVM-friendly, meaning if you installed chef or puppet
|
28
|
+
with an RVM managed Ruby, Vagrant now finds then. [GH-254]
|
29
|
+
- Changed the unused host only network destroy mechanism to check for
|
30
|
+
uselessness after the VM is destroyed. This should result in more accurate
|
31
|
+
checks.
|
32
|
+
- Networks are no longer disabled upon halt/destroy. With the above
|
33
|
+
change, its unnecessary.
|
34
|
+
- Puppet supports `module_path` configuration to mount local modules directory
|
35
|
+
as a shared folder and configure puppet with it. [GH-270]
|
36
|
+
- `ssh-config` now outputs `127.0.0.1` as the host instead of `localhost`.
|
37
|
+
|
1
38
|
## 0.6.9 (December 21, 2010)
|
2
39
|
|
3
40
|
- Puppet provisioner. [GH-223]
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -54,3 +54,8 @@ be installed with a simple `gem install bundler --pre`. Afterwords, do the follo
|
|
54
54
|
rake
|
55
55
|
|
56
56
|
This will run the test suite, which should come back all green! Then you're good to go!
|
57
|
+
|
58
|
+
If you want to run Vagrant without having to install the gem, you may use `bundle exec`,
|
59
|
+
like so:
|
60
|
+
|
61
|
+
bundle exec bin/vagrant help
|
data/config/default.rb
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
Vagrant::Config.run do |config|
|
2
2
|
# default config goes here
|
3
3
|
config.vagrant.dotfile_name = ".vagrant"
|
4
|
-
config.vagrant.home = "~/.vagrant"
|
5
4
|
config.vagrant.host = :detect
|
6
5
|
|
7
6
|
config.ssh.username = "vagrant"
|
8
7
|
config.ssh.host = "localhost"
|
9
|
-
config.ssh.port = 22
|
10
8
|
config.ssh.forwarded_port_key = "ssh"
|
11
9
|
config.ssh.max_tries = 10
|
12
10
|
config.ssh.timeout = 30
|
13
11
|
config.ssh.private_key_path = File.expand_path("keys/vagrant", Vagrant.source_root)
|
14
12
|
config.ssh.forward_agent = false
|
13
|
+
config.ssh.forward_x11 = false
|
15
14
|
|
16
15
|
config.vm.auto_port_range = (2200..2250)
|
17
16
|
config.vm.box_ovf = "box.ovf"
|
@@ -19,7 +18,6 @@ Vagrant::Config.run do |config|
|
|
19
18
|
config.vm.base_mac = nil
|
20
19
|
config.vm.forward_port("ssh", 22, 2222, :auto => true)
|
21
20
|
config.vm.disk_image_format = 'VMDK'
|
22
|
-
config.vm.provisioner = nil
|
23
21
|
config.vm.shared_folder_uid = nil
|
24
22
|
config.vm.shared_folder_gid = nil
|
25
23
|
config.vm.boot_mode = "vrdp"
|
data/contrib/README.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# Vagrant Contrib
|
2
|
+
|
3
|
+
Miscellaneous contributions which assist people in using Vagrant will
|
4
|
+
make their way into this directory. An up-to-date list of short descriptions
|
5
|
+
for each item will be kept below.
|
6
|
+
|
7
|
+
## List of Contrib Items
|
8
|
+
|
9
|
+
* `emacs` - Contains a file showing how to associate `Vagrantfile` with
|
10
|
+
Ruby syntax highlighting.
|
11
|
+
* `vim` - Contains a `.vim` file for enabling Ruby syntax highlighting
|
12
|
+
for `Vagrantfile`s.
|
@@ -0,0 +1,8 @@
|
|
1
|
+
;;--------------------------------------------------------------------
|
2
|
+
;; Teach emacs to syntax highlight Vagrantfile as Ruby.
|
3
|
+
;;
|
4
|
+
;; Installation: Copy the line below into your emacs configuration,
|
5
|
+
;; or drop this file anywhere in your "~/.emacs.d" directory and be
|
6
|
+
;; sure to "load" it.
|
7
|
+
;;--------------------------------------------------------------------
|
8
|
+
(add-to-list 'auto-mode-alist '("Vagrantfile$" . ruby-mode))
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Vagrant
|
2
|
+
class Action
|
3
|
+
module Box
|
4
|
+
autoload :Destroy, 'vagrant/action/box/destroy'
|
5
|
+
autoload :Download, 'vagrant/action/box/download'
|
6
|
+
autoload :Package, 'vagrant/action/box/package'
|
7
|
+
autoload :Unpackage, 'vagrant/action/box/unpackage'
|
8
|
+
autoload :Verify, 'vagrant/action/box/verify'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -30,7 +30,6 @@ module Vagrant
|
|
30
30
|
register(:halt, Builder.new do
|
31
31
|
use VM::DiscardState
|
32
32
|
use VM::Halt
|
33
|
-
use VM::DisableNetworks
|
34
33
|
end)
|
35
34
|
|
36
35
|
# suspend - Suspends the VM
|
@@ -62,9 +61,9 @@ module Vagrant
|
|
62
61
|
register(:destroy, Builder.new do
|
63
62
|
use Action[:halt], :force => true
|
64
63
|
use VM::ClearNFSExports
|
65
|
-
use VM::DestroyUnusedNetworkInterfaces
|
66
64
|
use VM::Destroy
|
67
65
|
use VM::CleanMachineFolder
|
66
|
+
use VM::DestroyUnusedNetworkInterfaces
|
68
67
|
end)
|
69
68
|
|
70
69
|
# package - Export and package the VM
|
@@ -13,6 +13,7 @@ module Vagrant
|
|
13
13
|
# Start up the VM and wait for it to boot.
|
14
14
|
boot
|
15
15
|
raise Errors::VMFailedToBoot if !wait_for_boot
|
16
|
+
|
16
17
|
@app.call(env)
|
17
18
|
end
|
18
19
|
|
@@ -24,7 +25,7 @@ module Vagrant
|
|
24
25
|
def wait_for_boot
|
25
26
|
@env.ui.info I18n.t("vagrant.actions.vm.boot.waiting")
|
26
27
|
|
27
|
-
@env
|
28
|
+
@env["config"].ssh.max_tries.to_i.times do |i|
|
28
29
|
if @env["vm"].ssh.up?
|
29
30
|
@env.ui.info I18n.t("vagrant.actions.vm.boot.ready")
|
30
31
|
return true
|
@@ -34,7 +35,7 @@ module Vagrant
|
|
34
35
|
# get shown
|
35
36
|
return true if @env.interrupted?
|
36
37
|
|
37
|
-
sleep
|
38
|
+
sleep 2 if !@env["vagrant.test"]
|
38
39
|
end
|
39
40
|
|
40
41
|
@env.ui.error I18n.t("vagrant.actions.vm.boot.failed")
|
@@ -31,7 +31,7 @@ module Vagrant
|
|
31
31
|
keep = Dir["#{f}/**/*"].find do |d|
|
32
32
|
# Find a file that doesn't have ".xml-prev" as the suffix,
|
33
33
|
# which signals that we want to keep this folder
|
34
|
-
File.file?(d) && !(File.basename(d) =~ /\.
|
34
|
+
File.file?(d) && !(File.basename(d) =~ /\.vbox-prev$/)
|
35
35
|
end
|
36
36
|
|
37
37
|
FileUtils.rm_rf(f) if !keep
|
@@ -9,20 +9,15 @@ module Vagrant
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def call(env)
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
interfaces = env["vm"].vm.network_adapters.collect do |adapter|
|
17
|
-
adapter.host_interface_object
|
18
|
-
end
|
12
|
+
# Destroy all the host only network adapters which are empty.
|
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
|
19
16
|
|
20
|
-
|
21
|
-
|
22
|
-
# attached VM (which must be this VM)
|
23
|
-
if interface.attached_vms.length == 1
|
17
|
+
# Destroy it if there is nothing attached
|
18
|
+
if iface.attached_vms.empty?
|
24
19
|
env.ui.info I18n.t("vagrant.actions.vm.destroy_network.destroying")
|
25
|
-
|
20
|
+
iface.destroy
|
26
21
|
end
|
27
22
|
end
|
28
23
|
|
@@ -25,8 +25,8 @@ module Vagrant
|
|
25
25
|
|
26
26
|
if enable_network?
|
27
27
|
@env.ui.info I18n.t("vagrant.actions.vm.network.enabling")
|
28
|
-
@env["vm"].system.prepare_host_only_network
|
29
28
|
@env.env.config.vm.network_options.compact.each do |network_options|
|
29
|
+
@env["vm"].system.prepare_host_only_network(network_options)
|
30
30
|
@env["vm"].system.enable_host_only_network(network_options)
|
31
31
|
end
|
32
32
|
end
|
@@ -113,7 +113,9 @@ module Vagrant
|
|
113
113
|
def mount_folders
|
114
114
|
@env.ui.info I18n.t("vagrant.actions.vm.nfs.mounting")
|
115
115
|
|
116
|
-
|
116
|
+
# Only mount the folders which have a guest path specified
|
117
|
+
am_folders = folders.select { |name, folder| folder[:guestpath] }
|
118
|
+
@env["vm"].system.mount_nfs(host_ip, Hash[am_folders])
|
117
119
|
end
|
118
120
|
|
119
121
|
# Returns the IP address of the first host only network adapter
|
@@ -2,49 +2,38 @@ module Vagrant
|
|
2
2
|
class Action
|
3
3
|
module VM
|
4
4
|
class Provision
|
5
|
+
attr_reader :provisioners
|
6
|
+
|
5
7
|
def initialize(app, env)
|
6
8
|
@app = app
|
7
9
|
@env = env
|
8
10
|
@env["provision.enabled"] = true if !@env.has_key?("provision.enabled")
|
11
|
+
@provisioners = []
|
9
12
|
|
10
|
-
|
13
|
+
load_provisioners if provisioning_enabled?
|
11
14
|
end
|
12
15
|
|
13
16
|
def call(env)
|
14
17
|
@app.call(env)
|
15
18
|
|
16
|
-
|
17
|
-
@env.ui.info I18n.t("vagrant.actions.vm.provision.beginning")
|
18
|
-
|
19
|
+
@provisioners.each do |instance|
|
20
|
+
@env.ui.info I18n.t("vagrant.actions.vm.provision.beginning", :provisioner => instance.class)
|
21
|
+
instance.provision!
|
19
22
|
end
|
20
23
|
end
|
21
24
|
|
22
25
|
def provisioning_enabled?
|
23
|
-
!@env["config"].vm.
|
26
|
+
!@env["config"].vm.provisioners.empty? && @env["provision.enabled"]
|
24
27
|
end
|
25
28
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
if provisioner.is_a?(Class)
|
30
|
-
@provisioner = provisioner.new(@env)
|
31
|
-
raise Errors::ProvisionInvalidClass if !@provisioner.is_a?(Provisioners::Base)
|
32
|
-
elsif provisioner.is_a?(Symbol)
|
33
|
-
# We have a few hard coded provisioners for built-ins
|
34
|
-
mapping = {
|
35
|
-
:chef_solo => Provisioners::ChefSolo,
|
36
|
-
:chef_server => Provisioners::ChefServer,
|
37
|
-
:puppet => Provisioners::Puppet
|
38
|
-
}
|
29
|
+
def load_provisioners
|
30
|
+
@env["config"].vm.provisioners.each do |provisioner|
|
31
|
+
@env.ui.info I18n.t("vagrant.actions.vm.provision.enabled", :provisioner => provisioner.shortcut)
|
39
32
|
|
40
|
-
|
41
|
-
|
42
|
-
@
|
33
|
+
instance = provisioner.provisioner.new(@env, provisioner.config)
|
34
|
+
instance.prepare
|
35
|
+
@provisioners << instance
|
43
36
|
end
|
44
|
-
|
45
|
-
@env.ui.info I18n.t("vagrant.actions.vm.provision.enabled", :provisioner => @provisioner.class.to_s)
|
46
|
-
@provisioner.prepare
|
47
|
-
@provisioner
|
48
37
|
end
|
49
38
|
end
|
50
39
|
end
|
@@ -50,10 +50,17 @@ module Vagrant
|
|
50
50
|
|
51
51
|
@env["vm"].ssh.execute do |ssh|
|
52
52
|
shared_folders.each do |name, data|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
if data[:guestpath]
|
54
|
+
# Guest path specified, so mount the folder to specified point
|
55
|
+
@env.ui.info(I18n.t("vagrant.actions.vm.share_folders.mounting_entry",
|
56
|
+
:name => name,
|
57
|
+
:guest_path => data[:guestpath]))
|
58
|
+
@env["vm"].system.mount_shared_folder(ssh, name, data[:guestpath])
|
59
|
+
else
|
60
|
+
# If no guest path is specified, then automounting is disabled
|
61
|
+
@env.ui.info(I18n.t("vagrant.actions.vm.share_folders.nomount_entry",
|
62
|
+
:name => name))
|
63
|
+
end
|
57
64
|
end
|
58
65
|
end
|
59
66
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Vagrant
|
2
|
+
class Action
|
3
|
+
module VM
|
4
|
+
autoload :Boot, 'vagrant/action/vm/boot'
|
5
|
+
autoload :CheckBox, 'vagrant/action/vm/check_box'
|
6
|
+
autoload :CheckGuestAdditions, 'vagrant/action/vm/check_guest_additions'
|
7
|
+
autoload :CleanMachineFolder, 'vagrant/action/vm/clean_machine_folder'
|
8
|
+
autoload :ClearForwardedPorts, 'vagrant/action/vm/clear_forwarded_ports'
|
9
|
+
autoload :ClearNFSExports, 'vagrant/action/vm/clear_nfs_exports'
|
10
|
+
autoload :ClearSharedFolders, 'vagrant/action/vm/clear_shared_folders'
|
11
|
+
autoload :Customize, 'vagrant/action/vm/customize'
|
12
|
+
autoload :Destroy, 'vagrant/action/vm/destroy'
|
13
|
+
autoload :DestroyUnusedNetworkInterfaces, 'vagrant/action/vm/destroy_unused_network_interfaces'
|
14
|
+
autoload :DiscardState, 'vagrant/action/vm/discard_state'
|
15
|
+
autoload :Export, 'vagrant/action/vm/export'
|
16
|
+
autoload :ForwardPorts, 'vagrant/action/vm/forward_ports'
|
17
|
+
autoload :Halt, 'vagrant/action/vm/halt'
|
18
|
+
autoload :Import, 'vagrant/action/vm/import'
|
19
|
+
autoload :MatchMACAddress, 'vagrant/action/vm/match_mac_address'
|
20
|
+
autoload :Network, 'vagrant/action/vm/network'
|
21
|
+
autoload :NFS, 'vagrant/action/vm/nfs'
|
22
|
+
autoload :Package, 'vagrant/action/vm/package'
|
23
|
+
autoload :PackageVagrantfile, 'vagrant/action/vm/package_vagrantfile'
|
24
|
+
autoload :Provision, 'vagrant/action/vm/provision'
|
25
|
+
autoload :Resume, 'vagrant/action/vm/resume'
|
26
|
+
autoload :ShareFolders, 'vagrant/action/vm/share_folders'
|
27
|
+
autoload :Suspend, 'vagrant/action/vm/suspend'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/vagrant/action.rb
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
require 'vagrant/action/builder'
|
2
|
+
require 'vagrant/action/builtin'
|
3
|
+
|
4
|
+
# The builtin middlewares
|
5
|
+
require 'vagrant/action/box'
|
6
|
+
require 'vagrant/action/env'
|
7
|
+
require 'vagrant/action/general'
|
8
|
+
require 'vagrant/action/vm'
|
9
|
+
|
1
10
|
module Vagrant
|
2
11
|
# Manages action running and registration. Every Vagrant environment
|
3
12
|
# has an instance of {Action} to allow for running in the context of
|
@@ -44,6 +53,9 @@ module Vagrant
|
|
44
53
|
# Where `:name` is the name of the registered action.
|
45
54
|
#
|
46
55
|
class Action
|
56
|
+
autoload :Environment, 'vagrant/action/environment'
|
57
|
+
autoload :Warden, 'vagrant/action/warden'
|
58
|
+
|
47
59
|
include Util
|
48
60
|
@@reported_interrupt = false
|
49
61
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Command
|
3
|
+
autoload :Base, 'vagrant/command/base'
|
4
|
+
autoload :GroupBase, 'vagrant/command/group_base'
|
5
|
+
autoload :Helpers, 'vagrant/command/helpers'
|
6
|
+
autoload :NamedBase, 'vagrant/command/named_base'
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
# The built-in commands must always be loaded
|
11
|
+
require 'vagrant/command/box'
|
12
|
+
require 'vagrant/command/destroy'
|
13
|
+
require 'vagrant/command/halt'
|
14
|
+
require 'vagrant/command/init'
|
15
|
+
require 'vagrant/command/package'
|
16
|
+
require 'vagrant/command/provision'
|
17
|
+
require 'vagrant/command/reload'
|
18
|
+
require 'vagrant/command/resume'
|
19
|
+
require 'vagrant/command/ssh'
|
20
|
+
require 'vagrant/command/ssh_config'
|
21
|
+
require 'vagrant/command/status'
|
22
|
+
require 'vagrant/command/suspend'
|
23
|
+
require 'vagrant/command/up'
|
24
|
+
require 'vagrant/command/upgrade_to_060'
|
25
|
+
require 'vagrant/command/version'
|
data/lib/vagrant/config/base.rb
CHANGED
@@ -4,9 +4,6 @@ module Vagrant
|
|
4
4
|
# basic things such as the environment instance variable which all
|
5
5
|
# config classes need as well as a basic `to_json` implementation.
|
6
6
|
class Base
|
7
|
-
# {Environment} that this config belongs to
|
8
|
-
attr_accessor :env
|
9
|
-
|
10
7
|
# {Top} of this configuration stack
|
11
8
|
attr_accessor :top
|
12
9
|
|
@@ -32,6 +29,23 @@ module Vagrant
|
|
32
29
|
end
|
33
30
|
end
|
34
31
|
|
32
|
+
# A helper to access the environment that this configuration is for.
|
33
|
+
# This is obtained by getting the env from the {Top}.
|
34
|
+
#
|
35
|
+
# @return [Vagrant::Envrionment]
|
36
|
+
def env
|
37
|
+
top.env
|
38
|
+
end
|
39
|
+
|
40
|
+
# Allows setting options from a hash. By default this simply calls
|
41
|
+
# the `#{key}=` method on the config class with the value, which is
|
42
|
+
# the expected behavior most of the time.
|
43
|
+
def set_options(options)
|
44
|
+
options.each do |key, value|
|
45
|
+
send("#{key}=", value)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
35
49
|
# Called by {Top} after the configuration is loaded to validate
|
36
50
|
# the configuaration objects. Subclasses should implement this
|
37
51
|
# method and add any errors to the `errors` object given.
|
data/lib/vagrant/config/ssh.rb
CHANGED
@@ -5,19 +5,19 @@ module Vagrant
|
|
5
5
|
|
6
6
|
attr_accessor :username
|
7
7
|
attr_accessor :host
|
8
|
-
attr_accessor :port
|
9
8
|
attr_accessor :forwarded_port_key
|
10
9
|
attr_accessor :max_tries
|
11
10
|
attr_accessor :timeout
|
12
11
|
attr_writer :private_key_path
|
13
12
|
attr_accessor :forward_agent
|
13
|
+
attr_accessor :forward_x11
|
14
14
|
|
15
15
|
def private_key_path
|
16
16
|
File.expand_path(@private_key_path, env.root_path)
|
17
17
|
end
|
18
18
|
|
19
19
|
def validate(errors)
|
20
|
-
[:username, :host, :
|
20
|
+
[:username, :host, :forwarded_port_key, :max_tries, :timeout, :private_key_path].each do |field|
|
21
21
|
errors.add(I18n.t("vagrant.config.common.error_empty", :field => field)) if !instance_variable_get("@#{field}".to_sym)
|
22
22
|
end
|
23
23
|
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Vagrant
|
2
|
+
class Config
|
3
|
+
# This class is the "top" configure class, which handles registering
|
4
|
+
# other configuration classes as well as validation of all configured
|
5
|
+
# classes. This is the object which is returned by {Environment#config}
|
6
|
+
# and has accessors to all other configuration classes.
|
7
|
+
#
|
8
|
+
# If you're looking to create your own configuration class, see {Base}.
|
9
|
+
class Top < Base
|
10
|
+
@@configures = {} if !defined?(@@configures)
|
11
|
+
|
12
|
+
# The environment that this configuration is for.
|
13
|
+
attr_reader :env
|
14
|
+
|
15
|
+
class << self
|
16
|
+
# The list of registered configuration classes as well as the key
|
17
|
+
# they're registered under.
|
18
|
+
def configures_list
|
19
|
+
@@configures ||= {}
|
20
|
+
end
|
21
|
+
|
22
|
+
# Registers a configuration class with the given key. This method shouldn't
|
23
|
+
# be called. Instead, inherit from {Base} and call {Base.configures}.
|
24
|
+
def configures(key, klass)
|
25
|
+
configures_list[key] = klass
|
26
|
+
attr_reader key.to_sym
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def initialize(env=nil)
|
31
|
+
self.class.configures_list.each do |key, klass|
|
32
|
+
config = klass.new
|
33
|
+
config.top = self
|
34
|
+
instance_variable_set("@#{key}".to_sym, config)
|
35
|
+
end
|
36
|
+
|
37
|
+
@env = env
|
38
|
+
end
|
39
|
+
|
40
|
+
# Validates the configuration classes of this instance and raises an
|
41
|
+
# exception if they are invalid. If you are implementing a custom configuration
|
42
|
+
# class, the method you want to implement is {Base#validate}. This is
|
43
|
+
# the method that checks all the validation, not one which defines
|
44
|
+
# validation rules.
|
45
|
+
def validate!
|
46
|
+
# Validate each of the configured classes and store the results into
|
47
|
+
# a hash.
|
48
|
+
errors = self.class.configures_list.inject({}) do |container, data|
|
49
|
+
key, _ = data
|
50
|
+
recorder = ErrorRecorder.new
|
51
|
+
send(key.to_sym).validate(recorder)
|
52
|
+
container[key.to_sym] = recorder if !recorder.errors.empty?
|
53
|
+
container
|
54
|
+
end
|
55
|
+
|
56
|
+
return if errors.empty?
|
57
|
+
raise Errors::ConfigValidationFailed, :messages => Util::TemplateRenderer.render("config/validation_failed", :errors => errors)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -4,15 +4,10 @@ module Vagrant
|
|
4
4
|
configures :vagrant
|
5
5
|
|
6
6
|
attr_accessor :dotfile_name
|
7
|
-
attr_accessor :home
|
8
7
|
attr_accessor :host
|
9
8
|
|
10
|
-
def initialize
|
11
|
-
@home = nil
|
12
|
-
end
|
13
|
-
|
14
9
|
def validate(errors)
|
15
|
-
[:dotfile_name, :
|
10
|
+
[:dotfile_name, :host].each do |field|
|
16
11
|
errors.add(I18n.t("vagrant.config.common.error_empty", :field => field)) if !instance_variable_get("@#{field}".to_sym)
|
17
12
|
end
|
18
13
|
end
|