vagrant 0.6.8 → 0.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +6 -5
- data/Gemfile.lock +0 -76
@@ -173,11 +173,25 @@ class PackageGeneralActionTest < Test::Unit::TestCase
|
|
173
173
|
seq = sequence("seq")
|
174
174
|
@instance.files_to_copy.each do |from, to|
|
175
175
|
FileUtils.expects(:mkdir_p).with(to.parent).in_sequence(seq)
|
176
|
+
File.expects(:directory?).with(from).returns(false).in_sequence(seq)
|
176
177
|
FileUtils.expects(:cp).with(from, to).in_sequence(seq)
|
177
178
|
end
|
178
179
|
|
179
180
|
@instance.copy_include_files
|
180
181
|
end
|
182
|
+
|
183
|
+
should "create the include directory and recursively copy globbed files to it" do
|
184
|
+
@env["package.include"] = ["foo*.txt"]
|
185
|
+
seq = sequence("seq")
|
186
|
+
@instance.files_to_copy.each do |from, to|
|
187
|
+
FileUtils.expects(:mkdir_p).with(to.parent).in_sequence(seq)
|
188
|
+
File.expects(:directory?).with(from).returns(true).in_sequence(seq)
|
189
|
+
Dir.expects(:glob).with(from).returns(from).in_sequence(seq)
|
190
|
+
FileUtils.expects(:cp_r).with(from, to.parent).in_sequence(seq)
|
191
|
+
end
|
192
|
+
|
193
|
+
@instance.copy_include_files
|
194
|
+
end
|
181
195
|
end
|
182
196
|
|
183
197
|
context "compression" do
|
@@ -16,6 +16,24 @@ class NetworkVMActionTest < Test::Unit::TestCase
|
|
16
16
|
end
|
17
17
|
|
18
18
|
context "initializing" do
|
19
|
+
should "raise an error if on windows and networking is enabled" do
|
20
|
+
Vagrant::Util::Platform.stubs(:windows?).returns(true)
|
21
|
+
@env.env.config.vm.network("foo")
|
22
|
+
|
23
|
+
assert_raises(Vagrant::Errors::NetworkNotImplemented) {
|
24
|
+
@klass.new(@app, @env)
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
should "not raise an error if not on windows and networking is enabled" do
|
29
|
+
Vagrant::Util::Platform.stubs(:windows?).returns(false)
|
30
|
+
@env.env.config.vm.network("foo")
|
31
|
+
|
32
|
+
assert_nothing_raised {
|
33
|
+
@klass.new(@app, @env)
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
19
37
|
should "verify no bridge collisions for each network enabled" do
|
20
38
|
@env.env.config.vm.network("foo")
|
21
39
|
@klass.any_instance.expects(:verify_no_bridge_collision).returns(true).once.with() do |options|
|
@@ -103,6 +103,10 @@ class ProvisionVMActionTest < Test::Unit::TestCase
|
|
103
103
|
should "set :chef_server to the ChefServer provisioner" do
|
104
104
|
provisioner_expectation(:chef_server, Vagrant::Provisioners::ChefServer)
|
105
105
|
end
|
106
|
+
|
107
|
+
should "set :puppet to the Puppet provisioner" do
|
108
|
+
provisioner_expectation(:puppet, Vagrant::Provisioners::Puppet)
|
109
|
+
end
|
106
110
|
end
|
107
111
|
end
|
108
112
|
|
@@ -39,7 +39,7 @@ class CommandHelpersTest < Test::Unit::TestCase
|
|
39
39
|
|
40
40
|
context "without multivm" do
|
41
41
|
setup do
|
42
|
-
@env.stubs(:vms
|
42
|
+
@env.stubs(:vms_ordered => [1, 2], :vms => {:one => 1, :two => 2})
|
43
43
|
end
|
44
44
|
|
45
45
|
should "raise an exception if a name is specified" do
|
@@ -59,7 +59,7 @@ class CommandHelpersTest < Test::Unit::TestCase
|
|
59
59
|
|
60
60
|
context "with multivm" do
|
61
61
|
setup do
|
62
|
-
@env.stubs(:vms
|
62
|
+
@env.stubs(:vms_ordered => [1, 2], :vms => {:one => 1, :two => 2})
|
63
63
|
end
|
64
64
|
|
65
65
|
should "return all the VMs if no name is specified" do
|
@@ -32,6 +32,14 @@ class ConfigVMTest < Test::Unit::TestCase
|
|
32
32
|
@config.define(:foo) {}
|
33
33
|
assert @config.has_multi_vms?
|
34
34
|
end
|
35
|
+
|
36
|
+
should "retain vm definition order" do
|
37
|
+
@config.define(:a) {}
|
38
|
+
@config.define(:b) {}
|
39
|
+
@config.define(:c) {}
|
40
|
+
|
41
|
+
assert_equal [:a, :b, :c], @config.defined_vm_keys
|
42
|
+
end
|
35
43
|
end
|
36
44
|
|
37
45
|
context "customizing" do
|
@@ -0,0 +1,135 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class PuppetProvisionerTest < Test::Unit::TestCase
|
4
|
+
setup do
|
5
|
+
@action_env = Vagrant::Action::Environment.new(vagrant_env.vms[:default].env)
|
6
|
+
|
7
|
+
@action = Vagrant::Provisioners::Puppet.new(@action_env)
|
8
|
+
@env = @action.env
|
9
|
+
@vm = @action.vm
|
10
|
+
end
|
11
|
+
|
12
|
+
context "preparing" do
|
13
|
+
should "share manifests" do
|
14
|
+
@action.expects(:check_manifest_dir).once
|
15
|
+
@action.expects(:share_manifests).once
|
16
|
+
@action.prepare
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "provisioning" do
|
21
|
+
should "run the proper sequence of methods in order" do
|
22
|
+
prov_seq = sequence("prov_seq")
|
23
|
+
@action.expects(:verify_binary).with("puppet").once.in_sequence(prov_seq)
|
24
|
+
@action.expects(:create_pp_path).once.in_sequence(prov_seq)
|
25
|
+
@action.expects(:set_manifest).once.in_sequence(prov_seq)
|
26
|
+
@action.expects(:run_puppet_client).once.in_sequence(prov_seq)
|
27
|
+
@action.provision!
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "check manifest_dir" do
|
32
|
+
setup do
|
33
|
+
@env.config.puppet.manifests_path = "manifests"
|
34
|
+
end
|
35
|
+
|
36
|
+
should "should not create the manifest directory if it exists" do
|
37
|
+
File.expects(:directory?).with(@env.config.puppet.manifests_path).returns(true)
|
38
|
+
@action.check_manifest_dir
|
39
|
+
end
|
40
|
+
|
41
|
+
should "create the manifest directory if it does not exist" do
|
42
|
+
File.stubs(:directory?).with(@env.config.puppet.manifests_path).returns(false)
|
43
|
+
Dir.expects(:mkdir).with(@env.config.puppet.manifests_path).once
|
44
|
+
@action.check_manifest_dir
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "share manifests folder" do
|
49
|
+
setup do
|
50
|
+
@manifests_path = "manifests"
|
51
|
+
@pp_path = "/tmp/vagrant-puppet"
|
52
|
+
@action.stubs(:manifests_path).returns(@manifests_path)
|
53
|
+
@action.stubs(:pp_path).returns(@pp_path)
|
54
|
+
end
|
55
|
+
|
56
|
+
should "share manifest folder" do
|
57
|
+
@env.config.vm.expects(:share_folder).with("manifests", @pp_path, @manifests_path)
|
58
|
+
@action.share_manifests
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context "verifying binary" do
|
63
|
+
setup do
|
64
|
+
@ssh = mock("ssh")
|
65
|
+
@vm.ssh.stubs(:execute).yields(@ssh)
|
66
|
+
end
|
67
|
+
|
68
|
+
should "verify binary exists" do
|
69
|
+
binary = "foo"
|
70
|
+
@ssh.expects(:exec!).with("which #{binary}", anything)
|
71
|
+
@action.verify_binary(binary)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context "create pp path" do
|
76
|
+
should "create and chown the folder to the ssh user" do
|
77
|
+
ssh_seq = sequence("ssh_seq")
|
78
|
+
ssh = mock("ssh")
|
79
|
+
ssh.expects(:exec!).with("sudo mkdir -p #{@env.config.puppet.pp_path}").once.in_sequence(ssh_seq)
|
80
|
+
ssh.expects(:exec!).with("sudo chown #{@env.config.ssh.username} #{@env.config.puppet.pp_path}").once.in_sequence(ssh_seq)
|
81
|
+
@vm.ssh.expects(:execute).yields(ssh)
|
82
|
+
@action.create_pp_path
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context "setting the manifest" do
|
87
|
+
setup do
|
88
|
+
@env.config.puppet.stubs(:manifests_path).returns("manifests")
|
89
|
+
@env.config.puppet.stubs(:manifest_file).returns("foo.pp")
|
90
|
+
@env.config.vm.stubs(:box).returns("base")
|
91
|
+
end
|
92
|
+
|
93
|
+
should "set the manifest if it exists" do
|
94
|
+
File.stubs(:exists?).with("#{@env.config.puppet.manifests_path}/#{@env.config.puppet.manifest_file}").returns(true)
|
95
|
+
@action.set_manifest
|
96
|
+
end
|
97
|
+
|
98
|
+
should "raise an error if the manifest does not exist" do
|
99
|
+
File.stubs(:exists?).with("#{@env.config.puppet.manifests_path}/#{@env.config.puppet.manifest_file}").returns(false)
|
100
|
+
assert_raises(Vagrant::Provisioners::PuppetError) {
|
101
|
+
@action.set_manifest
|
102
|
+
}
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context "running puppet client" do
|
107
|
+
setup do
|
108
|
+
@ssh = mock("ssh")
|
109
|
+
@vm.ssh.stubs(:execute).yields(@ssh)
|
110
|
+
end
|
111
|
+
|
112
|
+
should "cd into the pp_path directory and run puppet" do
|
113
|
+
@ssh.expects(:exec!).with("cd #{@env.config.puppet.pp_path} && sudo -E puppet #{@manifest}").once
|
114
|
+
@action.run_puppet_client
|
115
|
+
end
|
116
|
+
|
117
|
+
should "cd into the pp_path directory and run puppet with given options when given as an array" do
|
118
|
+
@env.config.puppet.options = ["--modulepath", "modules", "--verbose"]
|
119
|
+
@ssh.expects(:exec!).with("cd #{@env.config.puppet.pp_path} && sudo -E puppet --modulepath modules --verbose #{@manifest}").once
|
120
|
+
@action.run_puppet_client
|
121
|
+
end
|
122
|
+
|
123
|
+
should "cd into the pp_path directory and run puppet with the options when given as a string" do
|
124
|
+
@env.config.puppet.options = "--modulepath modules --verbose"
|
125
|
+
@ssh.expects(:exec!).with("cd #{@env.config.puppet.pp_path} && sudo -E puppet --modulepath modules --verbose #{@manifest}").once
|
126
|
+
@action.run_puppet_client
|
127
|
+
end
|
128
|
+
|
129
|
+
should "check the exit status if that is given" do
|
130
|
+
@ssh.stubs(:exec!).yields(nil, :exit_status, :foo)
|
131
|
+
@ssh.expects(:check_exit_status).with(:foo, anything).once
|
132
|
+
@action.run_puppet_client
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
data/test/vagrant/ssh_test.rb
CHANGED
@@ -195,16 +195,15 @@ class SshTest < Test::Unit::TestCase
|
|
195
195
|
end
|
196
196
|
|
197
197
|
should "return false if SSH connection times out" do
|
198
|
-
|
199
|
-
assert !@ssh.up?
|
200
|
-
end
|
198
|
+
@env.config.ssh.timeout = 0.5
|
201
199
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
200
|
+
Net::SSH.stubs(:start).with() do
|
201
|
+
# Sleep here to artificially fake timeout
|
202
|
+
sleep 1
|
203
|
+
true
|
204
|
+
end
|
205
|
+
|
206
|
+
assert !@ssh.up?
|
208
207
|
end
|
209
208
|
|
210
209
|
should "return false if the connection is refused" do
|
@@ -222,7 +221,11 @@ class SshTest < Test::Unit::TestCase
|
|
222
221
|
end
|
223
222
|
|
224
223
|
should "specifity the timeout as an option to execute" do
|
225
|
-
@ssh.expects(:execute).
|
224
|
+
@ssh.expects(:execute).yields(true).with() do |opts|
|
225
|
+
assert_equal @env.config.ssh.timeout, opts[:timeout]
|
226
|
+
true
|
227
|
+
end
|
228
|
+
|
226
229
|
assert @ssh.up?
|
227
230
|
end
|
228
231
|
|
@@ -230,6 +233,11 @@ class SshTest < Test::Unit::TestCase
|
|
230
233
|
@ssh.expects(:execute).raises(Net::SSH::AuthenticationFailed)
|
231
234
|
assert_raises(Vagrant::Errors::SSHAuthenticationFailed) { @ssh.up? }
|
232
235
|
end
|
236
|
+
|
237
|
+
should "only get the port once (in the main thread)" do
|
238
|
+
@ssh.expects(:port).once.returns(2222)
|
239
|
+
@ssh.up?
|
240
|
+
end
|
233
241
|
end
|
234
242
|
|
235
243
|
context "getting the ssh port" do
|
data/test/vagrant/vm_test.rb
CHANGED
@@ -119,7 +119,8 @@ class VMTest < Test::Unit::TestCase
|
|
119
119
|
context "with a symbol" do
|
120
120
|
should "initialize proper symbols" do
|
121
121
|
valid = {
|
122
|
-
:linux => Vagrant::Systems::Linux
|
122
|
+
:linux => Vagrant::Systems::Linux,
|
123
|
+
:solaris => Vagrant::Systems::Solaris
|
123
124
|
}
|
124
125
|
|
125
126
|
valid.each do |symbol, klass|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 6
|
8
|
-
-
|
9
|
-
version: 0.6.
|
8
|
+
- 9
|
9
|
+
version: 0.6.9
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mitchell Hashimoto
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-21 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -222,7 +222,6 @@ files:
|
|
222
222
|
- .yardopts
|
223
223
|
- CHANGELOG.md
|
224
224
|
- Gemfile
|
225
|
-
- Gemfile.lock
|
226
225
|
- LICENSE
|
227
226
|
- README.md
|
228
227
|
- Rakefile
|
@@ -317,6 +316,7 @@ files:
|
|
317
316
|
- lib/vagrant/provisioners/chef.rb
|
318
317
|
- lib/vagrant/provisioners/chef_server.rb
|
319
318
|
- lib/vagrant/provisioners/chef_solo.rb
|
319
|
+
- lib/vagrant/provisioners/puppet.rb
|
320
320
|
- lib/vagrant/ssh.rb
|
321
321
|
- lib/vagrant/systems/base.rb
|
322
322
|
- lib/vagrant/systems/linux.rb
|
@@ -413,6 +413,7 @@ files:
|
|
413
413
|
- test/vagrant/provisioners/chef_server_test.rb
|
414
414
|
- test/vagrant/provisioners/chef_solo_test.rb
|
415
415
|
- test/vagrant/provisioners/chef_test.rb
|
416
|
+
- test/vagrant/provisioners/puppet_test.rb
|
416
417
|
- test/vagrant/ssh_session_test.rb
|
417
418
|
- test/vagrant/ssh_test.rb
|
418
419
|
- test/vagrant/systems/linux_test.rb
|
@@ -441,7 +442,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
441
442
|
requirements:
|
442
443
|
- - ">="
|
443
444
|
- !ruby/object:Gem::Version
|
444
|
-
hash:
|
445
|
+
hash: -1856094503640076459
|
445
446
|
segments:
|
446
447
|
- 0
|
447
448
|
version: "0"
|
data/Gemfile.lock
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/mitchellh/virtualbox.git
|
3
|
-
revision: 041996145591d20acf3e04fef3d4709f826d878a
|
4
|
-
specs:
|
5
|
-
virtualbox (0.7.6.dev)
|
6
|
-
ffi (~> 0.6.3)
|
7
|
-
|
8
|
-
PATH
|
9
|
-
remote: .
|
10
|
-
specs:
|
11
|
-
vagrant (0.6.8)
|
12
|
-
archive-tar-minitar (= 0.5.2)
|
13
|
-
erubis (~> 2.6.6)
|
14
|
-
i18n (~> 0.4.1)
|
15
|
-
json (~> 1.4.6)
|
16
|
-
mario (~> 0.0.6)
|
17
|
-
net-scp (~> 1.0.3)
|
18
|
-
net-ssh (~> 2.0.23)
|
19
|
-
thor (~> 0.14.2)
|
20
|
-
virtualbox (~> 0.7.6)
|
21
|
-
|
22
|
-
GEM
|
23
|
-
remote: http://rubygems.org/
|
24
|
-
specs:
|
25
|
-
abstract (1.0.0)
|
26
|
-
archive-tar-minitar (0.5.2)
|
27
|
-
bluecloth (2.0.9)
|
28
|
-
columnize (0.3.1)
|
29
|
-
contest (0.1.2)
|
30
|
-
erubis (2.6.6)
|
31
|
-
abstract (>= 1.0.0)
|
32
|
-
ffi (0.6.3)
|
33
|
-
rake (>= 0.8.7)
|
34
|
-
i18n (0.4.1)
|
35
|
-
json (1.4.6)
|
36
|
-
linecache (0.43)
|
37
|
-
linecache19 (0.5.11)
|
38
|
-
ruby_core_source (>= 0.1.4)
|
39
|
-
mario (0.0.6)
|
40
|
-
mocha (0.9.8)
|
41
|
-
rake
|
42
|
-
net-scp (1.0.4)
|
43
|
-
net-ssh (>= 1.99.1)
|
44
|
-
net-ssh (2.0.23)
|
45
|
-
rake (0.8.7)
|
46
|
-
ruby-debug (0.10.3)
|
47
|
-
columnize (>= 0.1)
|
48
|
-
ruby-debug-base (~> 0.10.3.0)
|
49
|
-
ruby-debug-base (0.10.3)
|
50
|
-
linecache (>= 0.3)
|
51
|
-
ruby-debug-base19 (0.11.24)
|
52
|
-
columnize (>= 0.3.1)
|
53
|
-
linecache19 (>= 0.5.11)
|
54
|
-
ruby_core_source (>= 0.1.4)
|
55
|
-
ruby-debug19 (0.11.6)
|
56
|
-
columnize (>= 0.3.1)
|
57
|
-
linecache19 (>= 0.5.11)
|
58
|
-
ruby-debug-base19 (>= 0.11.19)
|
59
|
-
ruby_core_source (0.1.4)
|
60
|
-
archive-tar-minitar (>= 0.5.2)
|
61
|
-
thor (0.14.3)
|
62
|
-
yard (0.6.1)
|
63
|
-
|
64
|
-
PLATFORMS
|
65
|
-
ruby
|
66
|
-
|
67
|
-
DEPENDENCIES
|
68
|
-
bluecloth
|
69
|
-
contest (>= 0.1.2)
|
70
|
-
mocha
|
71
|
-
rake
|
72
|
-
ruby-debug
|
73
|
-
ruby-debug19
|
74
|
-
vagrant!
|
75
|
-
virtualbox!
|
76
|
-
yard (~> 0.6.1)
|