vagrantup 0.6.8 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/CHANGELOG.md +16 -1
- data/lib/vagrant/action.rb +1 -1
- data/lib/vagrant/action/box/download.rb +1 -1
- data/lib/vagrant/action/box/unpackage.rb +1 -1
- data/lib/vagrant/action/box/verify.rb +1 -1
- data/lib/vagrant/action/builder.rb +1 -1
- data/lib/vagrant/action/general/package.rb +10 -4
- data/lib/vagrant/action/vm/boot.rb +1 -1
- data/lib/vagrant/action/vm/check_box.rb +2 -2
- data/lib/vagrant/action/vm/export.rb +1 -1
- data/lib/vagrant/action/vm/forward_ports.rb +8 -8
- data/lib/vagrant/action/vm/import.rb +1 -1
- data/lib/vagrant/action/vm/network.rb +6 -2
- data/lib/vagrant/action/vm/nfs.rb +3 -3
- data/lib/vagrant/action/vm/provision.rb +4 -3
- data/lib/vagrant/action/warden.rb +5 -4
- data/lib/vagrant/box.rb +1 -1
- data/lib/vagrant/command/box.rb +2 -2
- data/lib/vagrant/command/helpers.rb +5 -5
- data/lib/vagrant/command/package.rb +3 -3
- data/lib/vagrant/command/ssh.rb +3 -3
- data/lib/vagrant/command/ssh_config.rb +2 -2
- data/lib/vagrant/config.rb +2 -2
- data/lib/vagrant/config/vm.rb +7 -0
- data/lib/vagrant/downloaders/file.rb +1 -1
- data/lib/vagrant/downloaders/http.rb +1 -1
- data/lib/vagrant/environment.rb +21 -5
- data/lib/vagrant/errors.rb +16 -0
- data/lib/vagrant/hosts/bsd.rb +1 -1
- data/lib/vagrant/provisioners/chef.rb +2 -2
- data/lib/vagrant/provisioners/chef_server.rb +3 -3
- data/lib/vagrant/provisioners/puppet.rb +85 -0
- data/lib/vagrant/ssh.rb +23 -21
- data/lib/vagrant/systems/linux.rb +1 -1
- data/lib/vagrant/systems/solaris.rb +7 -4
- data/lib/vagrant/util/hash_with_indifferent_access.rb +1 -1
- data/lib/vagrant/util/platform.rb +18 -1
- data/lib/vagrant/version.rb +1 -1
- data/lib/vagrant/vm.rb +4 -4
- data/templates/locales/en.yml +34 -4
- data/test/vagrant/action/general/package_test.rb +14 -0
- data/test/vagrant/action/vm/network_test.rb +18 -0
- data/test/vagrant/action/vm/provision_test.rb +4 -0
- data/test/vagrant/command/helpers_test.rb +2 -2
- data/test/vagrant/config/vm_test.rb +8 -0
- data/test/vagrant/provisioners/puppet_test.rb +135 -0
- data/test/vagrant/ssh_test.rb +18 -10
- data/test/vagrant/vm_test.rb +2 -1
- metadata +3 -2
- data/Gemfile.lock +0 -76
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7232347fee6bddc63b9f9869a127edc819e7a4f
|
4
|
+
data.tar.gz: 260ada61414d8de2b28de0778af29db557e7ec1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1140ff3dead7e131debb84d16c7da0f1bee3cc4109c3af3d518cd53275d5ec2050a8883fc3cd5f4f1c76b8bc7bfe9f3ba8ffd9f234bd051ec9fa130c0d05fc0a
|
7
|
+
data.tar.gz: f4c2492bd991fc8281e5b88a118f91dc13306e88048f5caba25e6cfdfcbce1d4d0ad236047d9c954843f019b888b54f910ea3a40431ad7b27487df7a3f3995ca
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,19 @@
|
|
1
|
-
## 0.6.
|
1
|
+
## 0.6.9 (December 21, 2010)
|
2
|
+
|
3
|
+
- Puppet provisioner. [GH-223]
|
4
|
+
- Solaris system configurable to use `sudo`.
|
5
|
+
- Solaris system registered, so it can be set with `:solaris`.
|
6
|
+
- `vagrant package` include can be a directory name, which will cause the
|
7
|
+
contents to be recursively copied into the package. [GH-241]
|
8
|
+
- Arbitrary options to puppet binary can be set with `config.puppet.options`. [GH-242]
|
9
|
+
- BSD hosts use proper GNU sed syntax for clearing NFS shares. [GH-243]
|
10
|
+
- Enumerate VMs in a multi-VM environment in order they were defined. [GH-244]
|
11
|
+
- Check for VM boot changed to use `timeout` library, which works better with Windows.
|
12
|
+
- Show special error if VirtualBox not detected on 64-bit Windows.
|
13
|
+
- Show error to Windows users attempting to use host only networking since
|
14
|
+
it doesn't work yet.
|
15
|
+
|
16
|
+
## 0.6.8 (November 30, 2010)
|
2
17
|
|
3
18
|
- Network interfaces are now up/down in distinct commands instead of just
|
4
19
|
restarting "networking." [GH-192]
|
data/lib/vagrant/action.rb
CHANGED
@@ -94,7 +94,7 @@ module Vagrant
|
|
94
94
|
callable = callable_id
|
95
95
|
callable = Builder.new.use(callable_id) if callable_id.kind_of?(Class)
|
96
96
|
callable = self.class.actions[callable_id] if callable_id.kind_of?(Symbol)
|
97
|
-
raise ArgumentError
|
97
|
+
raise ArgumentError, "Argument to run must be a callable object or registered action." if !callable || !callable.respond_to?(:call)
|
98
98
|
|
99
99
|
action_environment = Action::Environment.new(env)
|
100
100
|
action_environment.merge!(options || {})
|
@@ -37,7 +37,7 @@ module Vagrant
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def setup_box_directory
|
40
|
-
raise Errors::BoxAlreadyExists
|
40
|
+
raise Errors::BoxAlreadyExists, :name => @env["box"].name if File.directory?(@env["box"].directory)
|
41
41
|
|
42
42
|
FileUtils.mkdir_p(@env["box"].directory)
|
43
43
|
@box_directory = @env["box"].directory
|
@@ -12,7 +12,7 @@ module Vagrant
|
|
12
12
|
env.ui.info I18n.t("vagrant.actions.box.verify.verifying")
|
13
13
|
VirtualBox::Appliance.new(env["box"].ovf_file.to_s)
|
14
14
|
rescue Exception
|
15
|
-
raise Errors::BoxVerificationFailed
|
15
|
+
raise Errors::BoxVerificationFailed
|
16
16
|
end
|
17
17
|
|
18
18
|
@app.call(env)
|
@@ -24,7 +24,7 @@ module Vagrant
|
|
24
24
|
end
|
25
25
|
|
26
26
|
# Returns the current stack of middlewares. You probably won't
|
27
|
-
# need to use this directly, and
|
27
|
+
# need to use this directly, and it's recommended that you don't.
|
28
28
|
#
|
29
29
|
# @return [Array]
|
30
30
|
def stack
|
@@ -28,8 +28,8 @@ module Vagrant
|
|
28
28
|
def call(env)
|
29
29
|
@env = env
|
30
30
|
|
31
|
-
raise Errors::PackageOutputExists
|
32
|
-
raise Errors::PackageRequiresDirectory
|
31
|
+
raise Errors::PackageOutputExists if File.exist?(tar_path)
|
32
|
+
raise Errors::PackageRequiresDirectory if !@env["package.directory"] || !File.directory?(@env["package.directory"])
|
33
33
|
|
34
34
|
verify_files_to_copy
|
35
35
|
compress
|
@@ -57,7 +57,7 @@ module Vagrant
|
|
57
57
|
|
58
58
|
def verify_files_to_copy
|
59
59
|
files_to_copy.each do |file, _|
|
60
|
-
raise Errors::PackageIncludeMissing
|
60
|
+
raise Errors::PackageIncludeMissing, :file => file if !File.exist?(file)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -68,7 +68,13 @@ module Vagrant
|
|
68
68
|
files_to_copy.each do |from, to|
|
69
69
|
@env.ui.info I18n.t("vagrant.actions.general.package.packaging", :file => from)
|
70
70
|
FileUtils.mkdir_p(to.parent)
|
71
|
-
|
71
|
+
|
72
|
+
# Copy direcotry contents recursively.
|
73
|
+
if File.directory?(from)
|
74
|
+
FileUtils.cp_r(Dir.glob(from), to.parent)
|
75
|
+
else
|
76
|
+
FileUtils.cp(from, to)
|
77
|
+
end
|
72
78
|
end
|
73
79
|
end
|
74
80
|
|
@@ -8,11 +8,11 @@ module Vagrant
|
|
8
8
|
|
9
9
|
def call(env)
|
10
10
|
box_name = env["config"].vm.box
|
11
|
-
raise Errors::BoxNotSpecified
|
11
|
+
raise Errors::BoxNotSpecified if !box_name
|
12
12
|
|
13
13
|
if !env.env.boxes.find(box_name)
|
14
14
|
box_url = env["config"].vm.box_url
|
15
|
-
raise Errors::BoxSpecifiedDoesntExist
|
15
|
+
raise Errors::BoxSpecifiedDoesntExist, :name => box_name if !box_url
|
16
16
|
|
17
17
|
env.ui.info I18n.t("vagrant.actions.vm.check_box.not_found", :name => box_name)
|
18
18
|
Vagrant::Box.add(env.env, box_name, box_url)
|
@@ -23,7 +23,7 @@ module Vagrant
|
|
23
23
|
# 1024, which causes the forwarded ports to fail.
|
24
24
|
def threshold_check
|
25
25
|
@env.env.config.vm.forwarded_ports.each do |name, options|
|
26
|
-
raise Errors::ForwardPortBelowThreshold
|
26
|
+
raise Errors::ForwardPortBelowThreshold if options[:hostport] <= 1024
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -47,9 +47,9 @@ module Vagrant
|
|
47
47
|
if !options[:auto]
|
48
48
|
# Auto fixing is disabled for this port forward, so we
|
49
49
|
# must throw an error so the user can fix it.
|
50
|
-
raise Errors::ForwardPortCollision
|
51
|
-
|
52
|
-
|
50
|
+
raise Errors::ForwardPortCollision, :name => name,
|
51
|
+
:host_port => options[:hostport].to_s,
|
52
|
+
:guest_port => options[:guestport].to_s
|
53
53
|
end
|
54
54
|
|
55
55
|
# Get the auto port range and get rid of the used ports and
|
@@ -60,10 +60,10 @@ module Vagrant
|
|
60
60
|
range -= existing_ports
|
61
61
|
|
62
62
|
if range.empty?
|
63
|
-
raise Errors::ForwardPortAutolistEmpty
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
raise Errors::ForwardPortAutolistEmpty, :vm_name => @env["vm"].name,
|
64
|
+
:name => name,
|
65
|
+
:host_port => options[:hostport].to_s,
|
66
|
+
:guest_port => options[:guestport].to_s
|
67
67
|
end
|
68
68
|
|
69
69
|
# Set the port up to be the first one and add that port to
|
@@ -8,8 +8,12 @@ module Vagrant
|
|
8
8
|
@app = app
|
9
9
|
@env = env
|
10
10
|
|
11
|
+
if enable_network? && Util::Platform.windows?
|
12
|
+
raise Errors::NetworkNotImplemented
|
13
|
+
end
|
14
|
+
|
11
15
|
env["config"].vm.network_options.compact.each do |network_options|
|
12
|
-
raise Errors::NetworkCollision
|
16
|
+
raise Errors::NetworkCollision if !verify_no_bridge_collision(network_options)
|
13
17
|
end
|
14
18
|
end
|
15
19
|
|
@@ -83,7 +87,7 @@ module Vagrant
|
|
83
87
|
end
|
84
88
|
end
|
85
89
|
|
86
|
-
raise Errors::NetworkNotFound
|
90
|
+
raise Errors::NetworkNotFound, :name => net_options[:name] if net_options[:name]
|
87
91
|
|
88
92
|
# One doesn't exist, create it.
|
89
93
|
@env.ui.info I18n.t("vagrant.actions.vm.network.creating")
|
@@ -147,9 +147,9 @@ module Vagrant
|
|
147
147
|
|
148
148
|
# Verifies that the host is set and supports NFS.
|
149
149
|
def verify_settings
|
150
|
-
raise Errors::NFSHostRequired
|
151
|
-
raise Errors::NFSNotSupported
|
152
|
-
raise Errors::NFSNoHostNetwork
|
150
|
+
raise Errors::NFSHostRequired if @env["host"].nil?
|
151
|
+
raise Errors::NFSNotSupported if !@env["host"].nfs?
|
152
|
+
raise Errors::NFSNoHostNetwork if @env["config"].vm.network_options.empty?
|
153
153
|
end
|
154
154
|
end
|
155
155
|
end
|
@@ -28,16 +28,17 @@ module Vagrant
|
|
28
28
|
|
29
29
|
if provisioner.is_a?(Class)
|
30
30
|
@provisioner = provisioner.new(@env)
|
31
|
-
raise Errors::ProvisionInvalidClass
|
31
|
+
raise Errors::ProvisionInvalidClass if !@provisioner.is_a?(Provisioners::Base)
|
32
32
|
elsif provisioner.is_a?(Symbol)
|
33
33
|
# We have a few hard coded provisioners for built-ins
|
34
34
|
mapping = {
|
35
35
|
:chef_solo => Provisioners::ChefSolo,
|
36
|
-
:chef_server => Provisioners::ChefServer
|
36
|
+
:chef_server => Provisioners::ChefServer,
|
37
|
+
:puppet => Provisioners::Puppet
|
37
38
|
}
|
38
39
|
|
39
40
|
provisioner_klass = mapping[provisioner]
|
40
|
-
raise Errors::ProvisionUnknownType
|
41
|
+
raise Errors::ProvisionUnknownType, :provisioner => provisioner.to_s if provisioner_klass.nil?
|
41
42
|
@provisioner = provisioner_klass.new(@env)
|
42
43
|
end
|
43
44
|
|
@@ -7,8 +7,9 @@ module Vagrant
|
|
7
7
|
# exceptional events, and by providing a simple callback, can clean up
|
8
8
|
# in any erroneous case.
|
9
9
|
#
|
10
|
-
#
|
11
|
-
#
|
10
|
+
# Warden will "just work" behind the scenes, and is not of particular
|
11
|
+
# interest except to those who are curious about the internal workings
|
12
|
+
# of Vagrant.
|
12
13
|
class Warden
|
13
14
|
attr_accessor :actions, :stack
|
14
15
|
|
@@ -23,9 +24,9 @@ module Vagrant
|
|
23
24
|
begin
|
24
25
|
# Call the next middleware in the sequence, appending to the stack
|
25
26
|
# of "recoverable" middlewares in case something goes wrong!
|
26
|
-
raise Errors::VagrantInterrupt
|
27
|
+
raise Errors::VagrantInterrupt if env.interrupted?
|
27
28
|
@stack.unshift(@actions.shift).first.call(env)
|
28
|
-
raise Errors::VagrantInterrupt
|
29
|
+
raise Errors::VagrantInterrupt if env.interrupted?
|
29
30
|
rescue SystemExit
|
30
31
|
# This means that an "exit" or "abort" was called. In these cases,
|
31
32
|
# we just exit immediately.
|
data/lib/vagrant/box.rb
CHANGED
@@ -57,7 +57,7 @@ module Vagrant
|
|
57
57
|
# method requires that `name` and `uri` be set. The logic of this method
|
58
58
|
# is kicked out to the `box_add` registered middleware.
|
59
59
|
def add
|
60
|
-
raise Errors::BoxAlreadyExists
|
60
|
+
raise Errors::BoxAlreadyExists, :name => name if File.directory?(directory)
|
61
61
|
env.actions.run(:box_add, { "box" => self, "validate" => false })
|
62
62
|
end
|
63
63
|
|
data/lib/vagrant/command/box.rb
CHANGED
@@ -11,14 +11,14 @@ module Vagrant
|
|
11
11
|
desc "remove NAME", "Remove a box from the system"
|
12
12
|
def remove(name)
|
13
13
|
b = env.boxes.find(name)
|
14
|
-
raise Errors::BoxNotFound
|
14
|
+
raise Errors::BoxNotFound, :name => name if !b
|
15
15
|
b.destroy
|
16
16
|
end
|
17
17
|
|
18
18
|
desc "repackage NAME", "Repackage an installed box into a `.box` file."
|
19
19
|
def repackage(name)
|
20
20
|
b = env.boxes.find(name)
|
21
|
-
raise Errors::BoxNotFound
|
21
|
+
raise Errors::BoxNotFound, :name => name if !b
|
22
22
|
b.repackage
|
23
23
|
end
|
24
24
|
|
@@ -4,24 +4,24 @@ module Vagrant
|
|
4
4
|
# Initializes the environment by pulling the environment out of
|
5
5
|
# the configuration hash and sets up the UI if necessary.
|
6
6
|
def initialize_environment(args, options, config)
|
7
|
-
raise Errors::CLIMissingEnvironment
|
7
|
+
raise Errors::CLIMissingEnvironment if !config[:env]
|
8
8
|
@env = config[:env]
|
9
9
|
end
|
10
10
|
|
11
11
|
# This returns an array of {VM} objects depending on the arguments
|
12
12
|
# given to the command.
|
13
13
|
def target_vms(name=nil)
|
14
|
-
raise Errors::NoEnvironmentError
|
14
|
+
raise Errors::NoEnvironmentError if !env.root_path
|
15
15
|
|
16
16
|
name ||= self.name rescue nil
|
17
17
|
|
18
18
|
@target_vms ||= begin
|
19
19
|
if env.multivm?
|
20
|
-
return env.
|
20
|
+
return env.vms_ordered if !name
|
21
21
|
vm = env.vms[name.to_sym]
|
22
|
-
raise Errors::VMNotFoundError
|
22
|
+
raise Errors::VMNotFoundError, :name => name if !vm
|
23
23
|
else
|
24
|
-
raise Errors::MultiVMEnvironmentRequired
|
24
|
+
raise Errors::MultiVMEnvironmentRequired if name
|
25
25
|
vm = env.vms.values.first
|
26
26
|
end
|
27
27
|
|
@@ -16,14 +16,14 @@ module Vagrant
|
|
16
16
|
|
17
17
|
def package_base
|
18
18
|
vm = VM.find(options[:base], env)
|
19
|
-
raise Errors::BaseVMNotFound
|
19
|
+
raise Errors::BaseVMNotFound, :name => options[:base] if !vm.created?
|
20
20
|
package_vm(vm)
|
21
21
|
end
|
22
22
|
|
23
23
|
def package_target
|
24
|
-
raise Errors::MultiVMTargetRequired
|
24
|
+
raise Errors::MultiVMTargetRequired, :command => "package" if target_vms.length > 1
|
25
25
|
vm = target_vms.first
|
26
|
-
raise Errors::VMNotCreatedError
|
26
|
+
raise Errors::VMNotCreatedError if !vm.created?
|
27
27
|
package_vm(vm)
|
28
28
|
end
|
29
29
|
|
data/lib/vagrant/command/ssh.rb
CHANGED
@@ -24,15 +24,15 @@ module Vagrant
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def ssh_connect
|
27
|
-
raise Errors::VMNotCreatedError
|
28
|
-
raise Errors::VMNotRunningError
|
27
|
+
raise Errors::VMNotCreatedError if !ssh_vm.created?
|
28
|
+
raise Errors::VMNotRunningError if !ssh_vm.vm.running?
|
29
29
|
ssh_vm.ssh.connect
|
30
30
|
end
|
31
31
|
|
32
32
|
def ssh_vm
|
33
33
|
@ssh_vm ||= begin
|
34
34
|
vm = self.name.nil? && env.multivm? ? env.primary_vm : nil
|
35
|
-
raise Errors::MultiVMTargetRequired
|
35
|
+
raise Errors::MultiVMTargetRequired, :command => "ssh" if !vm && target_vms.length > 1
|
36
36
|
vm = target_vms.first if !vm
|
37
37
|
vm
|
38
38
|
end
|
@@ -5,9 +5,9 @@ module Vagrant
|
|
5
5
|
register "ssh_config", "outputs .ssh/config valid syntax for connecting to this environment via ssh"
|
6
6
|
|
7
7
|
def execute
|
8
|
-
raise Errors::MultiVMTargetRequired
|
8
|
+
raise Errors::MultiVMTargetRequired, :command => "ssh_config" if target_vms.length > 1
|
9
9
|
vm = target_vms.first
|
10
|
-
raise Errors::VMNotCreatedError
|
10
|
+
raise Errors::VMNotCreatedError if !vm.created?
|
11
11
|
|
12
12
|
$stdout.puts(Util::TemplateRenderer.render("ssh_config", {
|
13
13
|
:host_key => options[:host] || "vagrant",
|
data/lib/vagrant/config.rb
CHANGED
@@ -95,7 +95,7 @@ module Vagrant
|
|
95
95
|
load item
|
96
96
|
rescue SyntaxError => e
|
97
97
|
# Report syntax errors in a nice way for Vagrantfiles
|
98
|
-
raise Errors::VagrantfileSyntaxError
|
98
|
+
raise Errors::VagrantfileSyntaxError, :file => e.message
|
99
99
|
end
|
100
100
|
elsif item.is_a?(Proc)
|
101
101
|
self.class.run(&item)
|
@@ -159,7 +159,7 @@ module Vagrant
|
|
159
159
|
end
|
160
160
|
|
161
161
|
return if errors.empty?
|
162
|
-
raise Errors::ConfigValidationFailed
|
162
|
+
raise Errors::ConfigValidationFailed, :messages => Util::TemplateRenderer.render("config/validation_failed", :errors => errors)
|
163
163
|
end
|
164
164
|
end
|
165
165
|
end
|
data/lib/vagrant/config/vm.rb
CHANGED
@@ -88,8 +88,15 @@ module Vagrant
|
|
88
88
|
@defined_vms ||= {}
|
89
89
|
end
|
90
90
|
|
91
|
+
# This returns the keys of the sub-vms in the order they were
|
92
|
+
# defined.
|
93
|
+
def defined_vm_keys
|
94
|
+
@defined_vm_keys ||= []
|
95
|
+
end
|
96
|
+
|
91
97
|
def define(name, options=nil, &block)
|
92
98
|
options ||= {}
|
99
|
+
defined_vm_keys << name
|
93
100
|
defined_vms[name.to_sym] ||= SubVM.new
|
94
101
|
defined_vms[name.to_sym].options.merge!(options)
|
95
102
|
defined_vms[name.to_sym].push_proc(&block)
|