rvagrant 0.8.7.dev
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +25 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +386 -0
- data/Gemfile +21 -0
- data/LICENSE +21 -0
- data/README.md +61 -0
- data/Rakefile +11 -0
- data/bin/vagrant +28 -0
- data/config/default.rb +38 -0
- data/contrib/README.md +12 -0
- data/contrib/emacs/vagrant.el +8 -0
- data/contrib/vim/vagrantfile.vim +9 -0
- data/keys/README.md +17 -0
- data/keys/vagrant +27 -0
- data/keys/vagrant.ppk +26 -0
- data/keys/vagrant.pub +1 -0
- data/lib/vagrant.rb +44 -0
- data/lib/vagrant/action.rb +138 -0
- data/lib/vagrant/action/box.rb +11 -0
- data/lib/vagrant/action/box/destroy.rb +21 -0
- data/lib/vagrant/action/box/download.rb +72 -0
- data/lib/vagrant/action/box/package.rb +19 -0
- data/lib/vagrant/action/box/unpackage.rb +55 -0
- data/lib/vagrant/action/box/verify.rb +23 -0
- data/lib/vagrant/action/builder.rb +124 -0
- data/lib/vagrant/action/builtin.rb +108 -0
- data/lib/vagrant/action/env.rb +7 -0
- data/lib/vagrant/action/env/set.rb +18 -0
- data/lib/vagrant/action/environment.rb +50 -0
- data/lib/vagrant/action/general.rb +8 -0
- data/lib/vagrant/action/general/package.rb +113 -0
- data/lib/vagrant/action/general/validate.rb +19 -0
- data/lib/vagrant/action/vm.rb +34 -0
- data/lib/vagrant/action/vm/boot.rb +48 -0
- data/lib/vagrant/action/vm/check_accessible.rb +23 -0
- data/lib/vagrant/action/vm/check_box.rb +28 -0
- data/lib/vagrant/action/vm/check_guest_additions.rb +35 -0
- data/lib/vagrant/action/vm/clean_machine_folder.rb +43 -0
- data/lib/vagrant/action/vm/clear_forwarded_ports.rb +26 -0
- data/lib/vagrant/action/vm/clear_nfs_exports.rb +20 -0
- data/lib/vagrant/action/vm/clear_shared_folders.rb +27 -0
- data/lib/vagrant/action/vm/customize.rb +26 -0
- data/lib/vagrant/action/vm/destroy.rb +19 -0
- data/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb +30 -0
- data/lib/vagrant/action/vm/discard_state.rb +22 -0
- data/lib/vagrant/action/vm/export.rb +52 -0
- data/lib/vagrant/action/vm/forward_ports.rb +133 -0
- data/lib/vagrant/action/vm/forward_ports_helpers.rb +28 -0
- data/lib/vagrant/action/vm/halt.rb +29 -0
- data/lib/vagrant/action/vm/host_name.rb +21 -0
- data/lib/vagrant/action/vm/import.rb +40 -0
- data/lib/vagrant/action/vm/match_mac_address.rb +26 -0
- data/lib/vagrant/action/vm/modify.rb +37 -0
- data/lib/vagrant/action/vm/network.rb +146 -0
- data/lib/vagrant/action/vm/nfs.rb +160 -0
- data/lib/vagrant/action/vm/nfs_helpers.rb +11 -0
- data/lib/vagrant/action/vm/package.rb +23 -0
- data/lib/vagrant/action/vm/package_vagrantfile.rb +33 -0
- data/lib/vagrant/action/vm/provision.rb +34 -0
- data/lib/vagrant/action/vm/provisioner_cleanup.rb +26 -0
- data/lib/vagrant/action/vm/resume.rb +20 -0
- data/lib/vagrant/action/vm/share_folders.rb +78 -0
- data/lib/vagrant/action/vm/suspend.rb +20 -0
- data/lib/vagrant/action/warden.rb +85 -0
- data/lib/vagrant/box.rb +90 -0
- data/lib/vagrant/box_collection.rb +53 -0
- data/lib/vagrant/cli.rb +55 -0
- data/lib/vagrant/command.rb +25 -0
- data/lib/vagrant/command/base.rb +106 -0
- data/lib/vagrant/command/box.rb +33 -0
- data/lib/vagrant/command/destroy.rb +17 -0
- data/lib/vagrant/command/group_base.rb +107 -0
- data/lib/vagrant/command/halt.rb +18 -0
- data/lib/vagrant/command/helpers.rb +33 -0
- data/lib/vagrant/command/init.rb +14 -0
- data/lib/vagrant/command/named_base.rb +14 -0
- data/lib/vagrant/command/package.rb +41 -0
- data/lib/vagrant/command/provision.rb +23 -0
- data/lib/vagrant/command/reload.rb +17 -0
- data/lib/vagrant/command/resume.rb +17 -0
- data/lib/vagrant/command/ssh.rb +49 -0
- data/lib/vagrant/command/ssh_config.rb +29 -0
- data/lib/vagrant/command/status.rb +31 -0
- data/lib/vagrant/command/suspend.rb +17 -0
- data/lib/vagrant/command/up.rb +19 -0
- data/lib/vagrant/command/upgrade_to_060.rb +45 -0
- data/lib/vagrant/command/version.rb +13 -0
- data/lib/vagrant/config.rb +123 -0
- data/lib/vagrant/config/base.rb +85 -0
- data/lib/vagrant/config/error_recorder.rb +19 -0
- data/lib/vagrant/config/nfs.rb +10 -0
- data/lib/vagrant/config/package.rb +9 -0
- data/lib/vagrant/config/ssh.rb +38 -0
- data/lib/vagrant/config/top.rb +61 -0
- data/lib/vagrant/config/vagrant.rb +17 -0
- data/lib/vagrant/config/vm.rb +148 -0
- data/lib/vagrant/config/vm/provisioner.rb +56 -0
- data/lib/vagrant/config/vm/sub_vm.rb +17 -0
- data/lib/vagrant/data_store.rb +70 -0
- data/lib/vagrant/downloaders.rb +7 -0
- data/lib/vagrant/downloaders/base.rb +23 -0
- data/lib/vagrant/downloaders/file.rb +22 -0
- data/lib/vagrant/downloaders/http.rb +70 -0
- data/lib/vagrant/environment.rb +516 -0
- data/lib/vagrant/errors.rb +352 -0
- data/lib/vagrant/hosts.rb +9 -0
- data/lib/vagrant/hosts/arch.rb +27 -0
- data/lib/vagrant/hosts/base.rb +76 -0
- data/lib/vagrant/hosts/bsd.rb +58 -0
- data/lib/vagrant/hosts/fedora.rb +11 -0
- data/lib/vagrant/hosts/linux.rb +69 -0
- data/lib/vagrant/plugin.rb +79 -0
- data/lib/vagrant/provisioners.rb +9 -0
- data/lib/vagrant/provisioners/base.rb +67 -0
- data/lib/vagrant/provisioners/chef.rb +155 -0
- data/lib/vagrant/provisioners/chef_client.rb +120 -0
- data/lib/vagrant/provisioners/chef_solo.rb +135 -0
- data/lib/vagrant/provisioners/puppet.rb +137 -0
- data/lib/vagrant/provisioners/puppet_server.rb +55 -0
- data/lib/vagrant/provisioners/shell.rb +96 -0
- data/lib/vagrant/ssh.rb +224 -0
- data/lib/vagrant/ssh/session.rb +136 -0
- data/lib/vagrant/systems.rb +13 -0
- data/lib/vagrant/systems/arch.rb +34 -0
- data/lib/vagrant/systems/base.rb +87 -0
- data/lib/vagrant/systems/debian.rb +36 -0
- data/lib/vagrant/systems/freebsd.rb +84 -0
- data/lib/vagrant/systems/gentoo.rb +27 -0
- data/lib/vagrant/systems/linux.rb +82 -0
- data/lib/vagrant/systems/linux/config.rb +21 -0
- data/lib/vagrant/systems/linux/error.rb +9 -0
- data/lib/vagrant/systems/redhat.rb +48 -0
- data/lib/vagrant/systems/solaris.rb +67 -0
- data/lib/vagrant/systems/suse.rb +9 -0
- data/lib/vagrant/systems/ubuntu.rb +17 -0
- data/lib/vagrant/test_helpers.rb +128 -0
- data/lib/vagrant/ui.rb +81 -0
- data/lib/vagrant/util.rb +13 -0
- data/lib/vagrant/util/busy.rb +59 -0
- data/lib/vagrant/util/counter.rb +24 -0
- data/lib/vagrant/util/hash_with_indifferent_access.rb +63 -0
- data/lib/vagrant/util/platform.rb +57 -0
- data/lib/vagrant/util/retryable.rb +25 -0
- data/lib/vagrant/util/safe_exec.rb +35 -0
- data/lib/vagrant/util/stacked_proc_runner.rb +35 -0
- data/lib/vagrant/util/template_renderer.rb +83 -0
- data/lib/vagrant/version.rb +6 -0
- data/lib/vagrant/vm.rb +181 -0
- data/templates/chef_server_client.erb +32 -0
- data/templates/chef_solo_solo.erb +23 -0
- data/templates/commands/init/Vagrantfile.erb +86 -0
- data/templates/config/validation_failed.erb +7 -0
- data/templates/locales/en.yml +556 -0
- data/templates/network_entry_arch.erb +9 -0
- data/templates/network_entry_debian.erb +8 -0
- data/templates/network_entry_gentoo.erb +5 -0
- data/templates/network_entry_redhat.erb +9 -0
- data/templates/nfs/exports.erb +5 -0
- data/templates/nfs/exports_linux.erb +5 -0
- data/templates/package_Vagrantfile.erb +11 -0
- data/templates/ssh_config.erb +15 -0
- data/test/unit/locales/en.yml +8 -0
- data/test/unit/test_helper.rb +28 -0
- data/test/unit/vagrant/action/box/destroy_test.rb +18 -0
- data/test/unit/vagrant/action/box/download_test.rb +125 -0
- data/test/unit/vagrant/action/box/package_test.rb +25 -0
- data/test/unit/vagrant/action/box/unpackage_test.rb +84 -0
- data/test/unit/vagrant/action/box/verify_test.rb +30 -0
- data/test/unit/vagrant/action/builder_test.rb +207 -0
- data/test/unit/vagrant/action/env/set_test.rb +24 -0
- data/test/unit/vagrant/action/environment_test.rb +27 -0
- data/test/unit/vagrant/action/general/package_test.rb +268 -0
- data/test/unit/vagrant/action/general/validate_test.rb +31 -0
- data/test/unit/vagrant/action/vm/boot_test.rb +66 -0
- data/test/unit/vagrant/action/vm/check_accessible_test.rb +61 -0
- data/test/unit/vagrant/action/vm/check_box_test.rb +56 -0
- data/test/unit/vagrant/action/vm/check_guest_additions_test.rb +9 -0
- data/test/unit/vagrant/action/vm/clean_machine_folder_test.rb +84 -0
- data/test/unit/vagrant/action/vm/clear_forwarded_ports_test.rb +52 -0
- data/test/unit/vagrant/action/vm/clear_nfs_exports_test.rb +22 -0
- data/test/unit/vagrant/action/vm/clear_shared_folders_test.rb +40 -0
- data/test/unit/vagrant/action/vm/customize_test.rb +37 -0
- data/test/unit/vagrant/action/vm/destroy_test.rb +25 -0
- data/test/unit/vagrant/action/vm/destroy_unused_network_interfaces_test.rb +49 -0
- data/test/unit/vagrant/action/vm/discard_state_test.rb +45 -0
- data/test/unit/vagrant/action/vm/export_test.rb +107 -0
- data/test/unit/vagrant/action/vm/forward_ports_helpers_test.rb +77 -0
- data/test/unit/vagrant/action/vm/forward_ports_test.rb +213 -0
- data/test/unit/vagrant/action/vm/halt_test.rb +79 -0
- data/test/unit/vagrant/action/vm/host_name_test.rb +36 -0
- data/test/unit/vagrant/action/vm/import_test.rb +66 -0
- data/test/unit/vagrant/action/vm/match_mac_address_test.rb +40 -0
- data/test/unit/vagrant/action/vm/modify_test.rb +38 -0
- data/test/unit/vagrant/action/vm/network_test.rb +286 -0
- data/test/unit/vagrant/action/vm/nfs_helpers_test.rb +26 -0
- data/test/unit/vagrant/action/vm/nfs_test.rb +260 -0
- data/test/unit/vagrant/action/vm/package_test.rb +25 -0
- data/test/unit/vagrant/action/vm/package_vagrantfile_test.rb +46 -0
- data/test/unit/vagrant/action/vm/provision_test.rb +65 -0
- data/test/unit/vagrant/action/vm/provisioner_cleanup_test.rb +56 -0
- data/test/unit/vagrant/action/vm/resume_test.rb +35 -0
- data/test/unit/vagrant/action/vm/share_folders_test.rb +144 -0
- data/test/unit/vagrant/action/vm/suspend_test.rb +35 -0
- data/test/unit/vagrant/action/warden_test.rb +125 -0
- data/test/unit/vagrant/action_test.rb +89 -0
- data/test/unit/vagrant/box_collection_test.rb +45 -0
- data/test/unit/vagrant/box_test.rb +74 -0
- data/test/unit/vagrant/cli_test.rb +35 -0
- data/test/unit/vagrant/command/base_test.rb +23 -0
- data/test/unit/vagrant/command/group_base_test.rb +15 -0
- data/test/unit/vagrant/command/helpers_test.rb +88 -0
- data/test/unit/vagrant/command/package_test.rb +27 -0
- data/test/unit/vagrant/config/base_test.rb +52 -0
- data/test/unit/vagrant/config/error_recorder_test.rb +18 -0
- data/test/unit/vagrant/config/ssh_test.rb +12 -0
- data/test/unit/vagrant/config/vagrant_test.rb +35 -0
- data/test/unit/vagrant/config/vm/provisioner_test.rb +92 -0
- data/test/unit/vagrant/config/vm_test.rb +56 -0
- data/test/unit/vagrant/config_test.rb +162 -0
- data/test/unit/vagrant/data_store_test.rb +77 -0
- data/test/unit/vagrant/downloaders/base_test.rb +28 -0
- data/test/unit/vagrant/downloaders/file_test.rb +48 -0
- data/test/unit/vagrant/downloaders/http_test.rb +82 -0
- data/test/unit/vagrant/environment_test.rb +598 -0
- data/test/unit/vagrant/errors_test.rb +42 -0
- data/test/unit/vagrant/hosts/base_test.rb +46 -0
- data/test/unit/vagrant/hosts/bsd_test.rb +53 -0
- data/test/unit/vagrant/hosts/linux_test.rb +54 -0
- data/test/unit/vagrant/plugin_test.rb +9 -0
- data/test/unit/vagrant/provisioners/base_test.rb +63 -0
- data/test/unit/vagrant/provisioners/chef_client_test.rb +190 -0
- data/test/unit/vagrant/provisioners/chef_solo_test.rb +114 -0
- data/test/unit/vagrant/provisioners/chef_test.rb +202 -0
- data/test/unit/vagrant/provisioners/puppet_server_test.rb +68 -0
- data/test/unit/vagrant/provisioners/puppet_test.rb +182 -0
- data/test/unit/vagrant/provisioners/shell_test.rb +79 -0
- data/test/unit/vagrant/ssh/session_test.rb +40 -0
- data/test/unit/vagrant/ssh_test.rb +307 -0
- data/test/unit/vagrant/systems/base_test.rb +18 -0
- data/test/unit/vagrant/systems/linux_test.rb +104 -0
- data/test/unit/vagrant/ui_test.rb +29 -0
- data/test/unit/vagrant/util/busy_test.rb +106 -0
- data/test/unit/vagrant/util/counter_test.rb +29 -0
- data/test/unit/vagrant/util/hash_with_indifferent_access_test.rb +39 -0
- data/test/unit/vagrant/util/platform_test.rb +18 -0
- data/test/unit/vagrant/util/retryable_test.rb +50 -0
- data/test/unit/vagrant/util/stacked_proc_runner_test.rb +43 -0
- data/test/unit/vagrant/util/template_renderer_test.rb +145 -0
- data/test/unit/vagrant/vm_test.rb +300 -0
- data/vagrant.gemspec +35 -0
- metadata +431 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class BaseDownloaderTest < Test::Unit::TestCase
|
4
|
+
should "include the util class so subclasses have access to it" do
|
5
|
+
assert Vagrant::Downloaders::Base.include?(Vagrant::Util)
|
6
|
+
end
|
7
|
+
|
8
|
+
context "base instance" do
|
9
|
+
setup do
|
10
|
+
@env = vagrant_env
|
11
|
+
@base = Vagrant::Downloaders::Base.new(@env)
|
12
|
+
end
|
13
|
+
|
14
|
+
should "implement prepare which does nothing" do
|
15
|
+
assert_nothing_raised do
|
16
|
+
assert @base.respond_to?(:prepare)
|
17
|
+
@base.prepare("source")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
should "implement download! which does nothing" do
|
22
|
+
assert_nothing_raised do
|
23
|
+
assert @base.respond_to?(:download!)
|
24
|
+
@base.download!("source", "destination")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class FileDownloaderTest < Test::Unit::TestCase
|
4
|
+
setup do
|
5
|
+
@downloader, @tempfile = vagrant_mock_downloader(Vagrant::Downloaders::File)
|
6
|
+
@uri = "foo.box"
|
7
|
+
end
|
8
|
+
|
9
|
+
context "preparing" do
|
10
|
+
should "raise an exception if the file does not exist" do
|
11
|
+
File.expects(:file?).with(@uri).returns(false)
|
12
|
+
|
13
|
+
assert_raises(Vagrant::Errors::DownloaderFileDoesntExist) {
|
14
|
+
@downloader.prepare(@uri)
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "downloading" do
|
20
|
+
setup do
|
21
|
+
clean_paths
|
22
|
+
end
|
23
|
+
|
24
|
+
should "cp the file" do
|
25
|
+
uri = tmp_path.join("foo_source")
|
26
|
+
dest = tmp_path.join("foo_dest")
|
27
|
+
|
28
|
+
# Create the source file, then "download" it
|
29
|
+
File.open(uri, "w+") { |f| f.write("FOO") }
|
30
|
+
File.open(dest, "w+") do |dest_file|
|
31
|
+
@downloader.download!(uri, dest_file)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Finally, verify the destination file was properly created
|
35
|
+
assert File.file?(dest)
|
36
|
+
File.open(dest) do |f|
|
37
|
+
assert_equal "FOO", f.read
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "matching a uri" do
|
43
|
+
should "return true if the File exists on the file system" do
|
44
|
+
File.expects(:exists?).with('foo').returns(true)
|
45
|
+
assert Vagrant::Downloaders::File.match?('foo')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class HttpDownloaderTest < Test::Unit::TestCase
|
4
|
+
setup do
|
5
|
+
@downloader, @tempfile = vagrant_mock_downloader(Vagrant::Downloaders::HTTP)
|
6
|
+
@downloader.stubs(:report_progress)
|
7
|
+
@downloader.stubs(:complete_progress)
|
8
|
+
@uri = "http://google.com/"
|
9
|
+
end
|
10
|
+
|
11
|
+
context "downloading" do
|
12
|
+
setup do
|
13
|
+
ENV["http_proxy"] = nil
|
14
|
+
|
15
|
+
@parsed_uri = URI.parse(@uri)
|
16
|
+
@http = Net::HTTP.new(@parsed_uri.host, @parsed_uri.port)
|
17
|
+
Net::HTTP.stubs(:new).returns(@http)
|
18
|
+
@http.stubs(:start)
|
19
|
+
end
|
20
|
+
|
21
|
+
should "create a proper net/http object" do
|
22
|
+
Net::HTTP.expects(:new).with(@parsed_uri.host, @parsed_uri.port, nil, nil, nil, nil).once.returns(@http)
|
23
|
+
@http.expects(:start)
|
24
|
+
@downloader.download!(@uri, @tempfile)
|
25
|
+
end
|
26
|
+
|
27
|
+
should "create a proper net/http object with a proxy" do
|
28
|
+
ENV["http_proxy"] = "http://user:foo@google.com"
|
29
|
+
@proxy = URI.parse(ENV["http_proxy"])
|
30
|
+
Net::HTTP.expects(:new).with(@parsed_uri.host, @parsed_uri.port, @proxy.host, @proxy.port, @proxy.user, @proxy.password).once.returns(@http)
|
31
|
+
@http.expects(:start)
|
32
|
+
@downloader.download!(@uri, @tempfile)
|
33
|
+
end
|
34
|
+
|
35
|
+
should "enable SSL if scheme is https" do
|
36
|
+
@uri = "https://google.com/"
|
37
|
+
@http.expects(:use_ssl=).with(true).once
|
38
|
+
@downloader.download!(@uri, @tempfile)
|
39
|
+
end
|
40
|
+
|
41
|
+
should "read the body of the response and place each segment into the file" do
|
42
|
+
h = mock("http")
|
43
|
+
response = mock("response")
|
44
|
+
response.stubs(:content_length)
|
45
|
+
response.stubs(:is_a?).with(anything).returns(false)
|
46
|
+
response.stubs(:is_a?).with(Net::HTTPOK).returns(true)
|
47
|
+
segment = mock("segment")
|
48
|
+
segment.stubs(:length).returns(7)
|
49
|
+
|
50
|
+
@http.stubs(:start).yields(h)
|
51
|
+
h.expects(:request_get).with(@parsed_uri.request_uri).once.yields(response)
|
52
|
+
response.expects(:read_body).once.yields(segment)
|
53
|
+
@tempfile.expects(:write).with(segment).once
|
54
|
+
|
55
|
+
@downloader.download!(@uri, @tempfile)
|
56
|
+
end
|
57
|
+
|
58
|
+
should "error environment if invalid URL given" do
|
59
|
+
Net::HTTP.expects(:new).raises(SocketError.new)
|
60
|
+
|
61
|
+
assert_raises(Vagrant::Errors::DownloaderHTTPSocketError) {
|
62
|
+
@downloader.download!(@uri, @tempfile)
|
63
|
+
}
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context "matching the uri" do
|
68
|
+
should "use extract to verify that the string is in fact a uri" do
|
69
|
+
URI.expects(:extract).returns(['foo'])
|
70
|
+
assert Vagrant::Downloaders::HTTP.match?('foo')
|
71
|
+
end
|
72
|
+
|
73
|
+
should "return false if there are no extract results" do
|
74
|
+
URI.expects(:extract).returns([])
|
75
|
+
assert !Vagrant::Downloaders::HTTP.match?('foo')
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context "reporting progress" do
|
80
|
+
# TODO: Testing for this, probably
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,598 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
require "pathname"
|
3
|
+
require "tempfile"
|
4
|
+
|
5
|
+
class EnvironmentTest < Test::Unit::TestCase
|
6
|
+
setup do
|
7
|
+
@klass = Vagrant::Environment
|
8
|
+
|
9
|
+
clean_paths
|
10
|
+
end
|
11
|
+
|
12
|
+
context "class method check virtualbox version" do
|
13
|
+
setup do
|
14
|
+
VirtualBox.stubs(:version).returns("4.1.0")
|
15
|
+
end
|
16
|
+
|
17
|
+
should "not error and exit if everything is good" do
|
18
|
+
VirtualBox.expects(:version).returns("4.1.0")
|
19
|
+
assert_nothing_raised { @klass.check_virtualbox! }
|
20
|
+
end
|
21
|
+
|
22
|
+
should "error and exit if VirtualBox is not installed or detected" do
|
23
|
+
VirtualBox.expects(:version).returns(nil)
|
24
|
+
assert_raises(Vagrant::Errors::VirtualBoxNotDetected) { @klass.check_virtualbox! }
|
25
|
+
end
|
26
|
+
|
27
|
+
should "error and exit if VirtualBox is lower than version 4.0" do
|
28
|
+
version = "3.2.12r1041"
|
29
|
+
VirtualBox.expects(:version).returns(version)
|
30
|
+
assert_raises(Vagrant::Errors::VirtualBoxInvalidVersion) { @klass.check_virtualbox! }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "initialization" do
|
35
|
+
should "set the cwd if given" do
|
36
|
+
cwd = "foobarbaz"
|
37
|
+
env = @klass.new(:cwd => cwd)
|
38
|
+
assert_equal Pathname.new(cwd), env.cwd
|
39
|
+
end
|
40
|
+
|
41
|
+
should "default to pwd if cwd is nil" do
|
42
|
+
env = @klass.new
|
43
|
+
assert_equal Pathname.new(Dir.pwd), env.cwd
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "paths" do
|
48
|
+
setup do
|
49
|
+
@env = vagrant_env
|
50
|
+
end
|
51
|
+
|
52
|
+
context "dotfile path" do
|
53
|
+
should "build up the dotfile out of the root path and the dotfile name" do
|
54
|
+
assert_equal @env.root_path.join(@env.config.vagrant.dotfile_name), @env.dotfile_path
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context "home path" do
|
59
|
+
setup do
|
60
|
+
@env = @klass.new
|
61
|
+
|
62
|
+
# Make a fake home directory for helping with tests
|
63
|
+
@home_path = tmp_path.join("home")
|
64
|
+
ENV["HOME"] = @home_path.to_s
|
65
|
+
FileUtils.rm_rf(@home_path)
|
66
|
+
FileUtils.mkdir_p(@home_path)
|
67
|
+
end
|
68
|
+
|
69
|
+
should "return the home path if it loaded" do
|
70
|
+
ENV["VAGRANT_HOME"] = nil
|
71
|
+
|
72
|
+
expected = Pathname.new(File.expand_path(@klass::DEFAULT_HOME))
|
73
|
+
assert_equal expected, @env.home_path
|
74
|
+
end
|
75
|
+
|
76
|
+
should "return the home path set by the environmental variable" do
|
77
|
+
ENV["VAGRANT_HOME"] = "foo"
|
78
|
+
|
79
|
+
expected = Pathname.new(File.expand_path(ENV["VAGRANT_HOME"]))
|
80
|
+
assert_equal expected, @env.home_path
|
81
|
+
end
|
82
|
+
|
83
|
+
should "move the old home directory to the new location" do
|
84
|
+
new_path = @home_path.join(".vagrant.d")
|
85
|
+
old_path = @home_path.join(".vagrant")
|
86
|
+
old_path.mkdir
|
87
|
+
|
88
|
+
# Get the home path
|
89
|
+
ENV["VAGRANT_HOME"] = new_path.to_s
|
90
|
+
|
91
|
+
assert !new_path.exist?
|
92
|
+
assert_equal new_path, @env.home_path
|
93
|
+
assert !old_path.exist?
|
94
|
+
assert new_path.exist?
|
95
|
+
end
|
96
|
+
|
97
|
+
should "not move the old home directory if the new one already exists" do
|
98
|
+
new_path = @home_path.join(".vagrant.d")
|
99
|
+
new_path.mkdir
|
100
|
+
|
101
|
+
old_path = @home_path.join(".vagrant")
|
102
|
+
old_path.mkdir
|
103
|
+
|
104
|
+
# Get the home path
|
105
|
+
ENV["VAGRANT_HOME"] = new_path.to_s
|
106
|
+
|
107
|
+
assert new_path.exist?
|
108
|
+
assert_equal new_path, @env.home_path
|
109
|
+
assert old_path.exist?
|
110
|
+
assert new_path.exist?
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
context "temp path" do
|
115
|
+
should "return the home path joined with 'tmp'" do
|
116
|
+
assert_equal @env.home_path.join("tmp"), @env.tmp_path
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
context "boxes path" do
|
121
|
+
should "return the home path joined with 'tmp'" do
|
122
|
+
assert_equal @env.home_path.join("boxes"), @env.boxes_path
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context "resource" do
|
128
|
+
setup do
|
129
|
+
@env = vagrant_env
|
130
|
+
end
|
131
|
+
|
132
|
+
should "return 'vagrant' as a default" do
|
133
|
+
assert_equal 'vagrant', @env.resource
|
134
|
+
end
|
135
|
+
|
136
|
+
should "return the VM name if it is specified" do
|
137
|
+
@env.stubs(:vm).returns(mock("vm", :name => "foo"))
|
138
|
+
assert_equal "foo", @env.resource
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
context "primary VM helper" do
|
143
|
+
should "return the first VM if not multivm" do
|
144
|
+
env = vagrant_env
|
145
|
+
assert_equal env.vms[@klass::DEFAULT_VM], env.primary_vm
|
146
|
+
end
|
147
|
+
|
148
|
+
should "call and return the primary VM from the parent if has one" do
|
149
|
+
env = vagrant_env(vagrantfile(<<-vf))
|
150
|
+
config.vm.define(:web, :primary => true) do; end
|
151
|
+
config.vm.define :db do; end
|
152
|
+
vf
|
153
|
+
|
154
|
+
assert_equal :web, env.primary_vm.name
|
155
|
+
end
|
156
|
+
|
157
|
+
should "return nil if no VM is marked as primary" do
|
158
|
+
env = vagrant_env(vagrantfile(<<-vf))
|
159
|
+
config.vm.define :web
|
160
|
+
config.vm.define :db
|
161
|
+
config.vm.define :utility
|
162
|
+
vf
|
163
|
+
|
164
|
+
assert env.primary_vm.nil?
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
context "multivm? helper" do
|
169
|
+
should "return true if VM length greater than 1" do
|
170
|
+
env = vagrant_env(vagrantfile(<<-vf))
|
171
|
+
config.vm.define :web
|
172
|
+
config.vm.define :db
|
173
|
+
vf
|
174
|
+
|
175
|
+
assert env.multivm?
|
176
|
+
end
|
177
|
+
|
178
|
+
should "return true if VM length is 1 and a sub-VM is defined" do
|
179
|
+
env = vagrant_env(vagrantfile(<<-vf))
|
180
|
+
config.vm.define :web
|
181
|
+
vf
|
182
|
+
|
183
|
+
assert env.multivm?
|
184
|
+
end
|
185
|
+
|
186
|
+
should "return false if only default VM exists" do
|
187
|
+
assert !vagrant_env.multivm?
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
context "local data" do
|
192
|
+
should "lazy load the data store only once" do
|
193
|
+
result = { :foo => :bar }
|
194
|
+
Vagrant::DataStore.expects(:new).returns(result).once
|
195
|
+
env = vagrant_env
|
196
|
+
assert_equal result, env.local_data
|
197
|
+
assert_equal result, env.local_data
|
198
|
+
assert_equal result, env.local_data
|
199
|
+
end
|
200
|
+
|
201
|
+
should "return the parent's local data if a parent exists" do
|
202
|
+
env = vagrant_env(vagrantfile(<<-vf))
|
203
|
+
config.vm.define :web
|
204
|
+
config.vm.define :db
|
205
|
+
vf
|
206
|
+
|
207
|
+
env.local_data[:foo] = :bar
|
208
|
+
|
209
|
+
Vagrant::DataStore.expects(:new).never
|
210
|
+
assert_equal :bar, env.vms[:web].env.local_data[:foo]
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
context "accessing host" do
|
215
|
+
should "load the host once" do
|
216
|
+
env = @klass.new(:cwd => vagrantfile)
|
217
|
+
result = mock("result")
|
218
|
+
Vagrant::Hosts::Base.expects(:load).with(env, env.config.vagrant.host).once.returns(result)
|
219
|
+
assert_equal result, env.host
|
220
|
+
assert_equal result, env.host
|
221
|
+
assert_equal result, env.host
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
context "accessing actions" do
|
226
|
+
should "initialize the Action object with the given environment" do
|
227
|
+
env = @klass.new(:cwd => vagrant_app)
|
228
|
+
result = mock("result")
|
229
|
+
Vagrant::Action.expects(:new).with(env).returns(result).once
|
230
|
+
assert_equal result, env.actions
|
231
|
+
assert_equal result, env.actions
|
232
|
+
assert_equal result, env.actions
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
context "global data" do
|
237
|
+
should "lazy load the data store only once" do
|
238
|
+
env = vagrant_env
|
239
|
+
store = env.global_data
|
240
|
+
|
241
|
+
assert env.global_data.equal?(store)
|
242
|
+
assert env.global_data.equal?(store)
|
243
|
+
assert env.global_data.equal?(store)
|
244
|
+
end
|
245
|
+
|
246
|
+
should "return the parent's global data if a parent exists" do
|
247
|
+
env = vagrant_env(vagrantfile(<<-vf))
|
248
|
+
config.vm.define :web
|
249
|
+
config.vm.define :db
|
250
|
+
vf
|
251
|
+
|
252
|
+
result = env.global_data
|
253
|
+
assert env.vms[:web].env.global_data.equal?(result)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
context "loading logger" do
|
258
|
+
should "lazy load the logger only once" do
|
259
|
+
env = vagrant_env
|
260
|
+
result = env.logger
|
261
|
+
assert result === env.logger
|
262
|
+
end
|
263
|
+
|
264
|
+
should "return the parent's logger if a parent exists" do
|
265
|
+
env = vagrant_env(vagrantfile(<<-vf))
|
266
|
+
config.vm.define :web
|
267
|
+
config.vm.define :db
|
268
|
+
vf
|
269
|
+
|
270
|
+
assert env.logger === env.vms[:web].env.logger
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
context "loading the root path" do
|
275
|
+
should "should walk the parent directories looking for rootfile" do
|
276
|
+
paths = [Pathname.new("/foo/bar/baz"),
|
277
|
+
Pathname.new("/foo/bar"),
|
278
|
+
Pathname.new("/foo"),
|
279
|
+
Pathname.new("/")
|
280
|
+
]
|
281
|
+
|
282
|
+
rootfile = "Foo"
|
283
|
+
|
284
|
+
search_seq = sequence("search_seq")
|
285
|
+
paths.each do |path|
|
286
|
+
File.expects(:exist?).with(path.join(rootfile).to_s).returns(false).in_sequence(search_seq)
|
287
|
+
File.expects(:exist?).with(path).returns(true).in_sequence(search_seq) if !path.root?
|
288
|
+
end
|
289
|
+
|
290
|
+
assert !@klass.new(:cwd => paths.first, :vagrantfile_name => rootfile).root_path
|
291
|
+
end
|
292
|
+
|
293
|
+
should "should set the path for the rootfile" do
|
294
|
+
rootfile = "Foo"
|
295
|
+
path = Pathname.new(File.expand_path("/foo"))
|
296
|
+
File.expects(:exist?).with(path.join(rootfile).to_s).returns(true)
|
297
|
+
|
298
|
+
assert_equal path, @klass.new(:cwd => path, :vagrantfile_name => rootfile).root_path
|
299
|
+
end
|
300
|
+
|
301
|
+
should "not infinite loop on relative paths" do
|
302
|
+
assert @klass.new(:cwd => "../test").root_path.nil?
|
303
|
+
end
|
304
|
+
|
305
|
+
should "only load the root path once" do
|
306
|
+
rootfile = "foo"
|
307
|
+
env = @klass.new(:vagrantfile_name => rootfile)
|
308
|
+
File.expects(:exist?).with(env.cwd.join(rootfile).to_s).returns(true).once
|
309
|
+
|
310
|
+
assert_equal env.cwd, env.root_path
|
311
|
+
assert_equal env.cwd, env.root_path
|
312
|
+
assert_equal env.cwd, env.root_path
|
313
|
+
end
|
314
|
+
|
315
|
+
should "only load the root path once even if nil" do
|
316
|
+
File.stubs(:exist?).returns(false)
|
317
|
+
|
318
|
+
env = @klass.new
|
319
|
+
assert env.root_path.nil?
|
320
|
+
assert env.root_path.nil?
|
321
|
+
assert env.root_path.nil?
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
context "locking" do
|
326
|
+
setup do
|
327
|
+
@instance = @klass.new(:lock_path => Tempfile.new('vagrant-test').path)
|
328
|
+
end
|
329
|
+
|
330
|
+
should "allow nesting locks" do
|
331
|
+
assert_nothing_raised do
|
332
|
+
@instance.lock do
|
333
|
+
@instance.lock do
|
334
|
+
# Nothing
|
335
|
+
end
|
336
|
+
end
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
should "raise an exception if an environment already has a lock" do
|
341
|
+
@another = @klass.new(:lock_path => @instance.lock_path)
|
342
|
+
|
343
|
+
# Create first locked thread which should succeed
|
344
|
+
first = Thread.new do
|
345
|
+
begin
|
346
|
+
@instance.lock do
|
347
|
+
Thread.current[:locked] = true
|
348
|
+
loop { sleep 1000 }
|
349
|
+
end
|
350
|
+
rescue Vagrant::Errors::EnvironmentLockedError
|
351
|
+
Thread.current[:locked] = false
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
# Wait until the first thread has acquired the lock
|
356
|
+
loop do
|
357
|
+
break if first[:locked] || !first.alive?
|
358
|
+
Thread.pass
|
359
|
+
end
|
360
|
+
|
361
|
+
# Verify that the fist got the lock
|
362
|
+
assert first[:locked]
|
363
|
+
|
364
|
+
# Create second locked thread which should fail
|
365
|
+
second = Thread.new do
|
366
|
+
begin
|
367
|
+
@another.lock do
|
368
|
+
Thread.current[:error] = false
|
369
|
+
end
|
370
|
+
rescue Vagrant::Errors::EnvironmentLockedError
|
371
|
+
Thread.current[:error] = true
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
375
|
+
# Wait for the second to end and verify it failed
|
376
|
+
second.join
|
377
|
+
assert second[:error]
|
378
|
+
|
379
|
+
# Make sure both threads are killed
|
380
|
+
first.kill
|
381
|
+
second.kill
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
context "accessing the configuration" do
|
386
|
+
should "load the environment if its not already loaded" do
|
387
|
+
env = @klass.new(:cwd => vagrantfile)
|
388
|
+
env.expects(:load!).once
|
389
|
+
env.config
|
390
|
+
end
|
391
|
+
|
392
|
+
should "not load the environment if its already loaded" do
|
393
|
+
env = vagrant_env
|
394
|
+
env.expects(:load!).never
|
395
|
+
env.config
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
context "accessing the box collection" do
|
400
|
+
should "create a box collection representing the environment" do
|
401
|
+
env = vagrant_env
|
402
|
+
assert env.boxes.is_a?(Vagrant::BoxCollection)
|
403
|
+
assert_equal env, env.boxes.env
|
404
|
+
end
|
405
|
+
|
406
|
+
should "not load the environment if its already loaded" do
|
407
|
+
env = vagrant_env
|
408
|
+
env.expects(:load!).never
|
409
|
+
env.boxes
|
410
|
+
end
|
411
|
+
|
412
|
+
should "return the parent's box collection if it has one" do
|
413
|
+
env = vagrant_env(vagrantfile(<<-vf))
|
414
|
+
config.vm.define :web
|
415
|
+
config.vm.define :db
|
416
|
+
vf
|
417
|
+
|
418
|
+
assert env.vms[:web].env.boxes.equal?(env.boxes)
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|
422
|
+
context "accessing the current box" do
|
423
|
+
should "return the box that is specified in the config" do
|
424
|
+
vagrant_box("foo")
|
425
|
+
env = vagrant_env(vagrantfile(<<-vf))
|
426
|
+
config.vm.box = "foo"
|
427
|
+
vf
|
428
|
+
|
429
|
+
assert env.box
|
430
|
+
assert_equal "foo", env.box.name
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
434
|
+
context "accessing the VMs hash" do
|
435
|
+
should "load the environment if its not already loaded" do
|
436
|
+
env = @klass.new(:cwd => vagrantfile)
|
437
|
+
assert !env.loaded?
|
438
|
+
env.vms
|
439
|
+
assert env.loaded?
|
440
|
+
end
|
441
|
+
|
442
|
+
should "not load the environment if its already loaded" do
|
443
|
+
env = vagrant_env
|
444
|
+
env.expects(:load!).never
|
445
|
+
env.vms
|
446
|
+
end
|
447
|
+
|
448
|
+
should "return the parent's VMs hash if it has one" do
|
449
|
+
env = vagrant_env(vagrantfile(<<-vf))
|
450
|
+
config.vm.define :web
|
451
|
+
config.vm.define :db
|
452
|
+
vf
|
453
|
+
|
454
|
+
assert env.vms[:web].env.vms.equal?(env.vms)
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
context "loading" do
|
459
|
+
context "overall load method" do
|
460
|
+
should "load! should call proper sequence and return itself" do
|
461
|
+
env = @klass.new(:cwd => vagrantfile)
|
462
|
+
call_seq = sequence("call_sequence")
|
463
|
+
@klass.expects(:check_virtualbox!).once.in_sequence(call_seq)
|
464
|
+
env.expects(:load_config!).once.in_sequence(call_seq)
|
465
|
+
assert_equal env, env.load!
|
466
|
+
end
|
467
|
+
end
|
468
|
+
|
469
|
+
context "loading config" do
|
470
|
+
setup do
|
471
|
+
clean_paths
|
472
|
+
@env = @klass.new(:cwd => vagrantfile)
|
473
|
+
end
|
474
|
+
|
475
|
+
def create_box_vagrantfile
|
476
|
+
vagrantfile(vagrant_box("box"), <<-FILE)
|
477
|
+
config.package.name = "box.box"
|
478
|
+
config.vm.base_mac = "set"
|
479
|
+
FILE
|
480
|
+
end
|
481
|
+
|
482
|
+
def create_home_vagrantfile
|
483
|
+
vagrantfile(home_path, 'config.package.name = "home.box"')
|
484
|
+
end
|
485
|
+
|
486
|
+
def create_root_vagrantfile
|
487
|
+
vagrantfile(@env.root_path, 'config.package.name = "root.box"')
|
488
|
+
end
|
489
|
+
|
490
|
+
should "load from the project root" do
|
491
|
+
assert_equal "package.box", @env.config.package.name
|
492
|
+
end
|
493
|
+
|
494
|
+
should "load from box if specified" do
|
495
|
+
create_box_vagrantfile
|
496
|
+
vagrantfile(@env.root_path, "config.vm.box = 'box'")
|
497
|
+
|
498
|
+
assert_equal "box.box", @env.primary_vm.env.config.package.name
|
499
|
+
end
|
500
|
+
|
501
|
+
should "load from home path if exists" do
|
502
|
+
create_home_vagrantfile
|
503
|
+
assert_equal "home.box", @env.config.package.name
|
504
|
+
end
|
505
|
+
|
506
|
+
should "load from root path" do
|
507
|
+
create_home_vagrantfile
|
508
|
+
create_root_vagrantfile
|
509
|
+
assert_equal "root.box", @env.config.package.name
|
510
|
+
end
|
511
|
+
|
512
|
+
should "load from a sub-vm configuration if environment represents a VM" do
|
513
|
+
create_home_vagrantfile
|
514
|
+
create_box_vagrantfile
|
515
|
+
vagrantfile(@env.root_path, <<-vf)
|
516
|
+
config.package.name = "root.box"
|
517
|
+
config.vm.define :web do |web|
|
518
|
+
web.vm.box = "box"
|
519
|
+
web.package.name = "web.box"
|
520
|
+
end
|
521
|
+
vf
|
522
|
+
|
523
|
+
assert_equal "root.box", @env.config.package.name
|
524
|
+
assert_equal "web.box", @env.vms[:web].env.config.package.name
|
525
|
+
assert_equal "set", @env.vms[:web].env.config.vm.base_mac
|
526
|
+
end
|
527
|
+
|
528
|
+
should "be able to reload config" do
|
529
|
+
vagrantfile(@env.root_path, "config.vm.box = 'box'")
|
530
|
+
|
531
|
+
# First load the config normally
|
532
|
+
@env.load_config!
|
533
|
+
assert_equal "box", @env.config.vm.box
|
534
|
+
assert_not_equal "set", @env.config.vm.base_mac
|
535
|
+
|
536
|
+
# Modify the Vagrantfile and reload it, then verify new results
|
537
|
+
# are available
|
538
|
+
vagrantfile(@env.root_path, "config.vm.base_mac = 'set'")
|
539
|
+
@env.reload_config!
|
540
|
+
assert_equal "set", @env.config.vm.base_mac
|
541
|
+
end
|
542
|
+
end
|
543
|
+
|
544
|
+
context "loading home directory" do
|
545
|
+
setup do
|
546
|
+
@env = vagrant_env
|
547
|
+
|
548
|
+
File.stubs(:directory?).returns(true)
|
549
|
+
FileUtils.stubs(:mkdir_p)
|
550
|
+
end
|
551
|
+
|
552
|
+
should "create each directory if it doesn't exist" do
|
553
|
+
create_seq = sequence("create_seq")
|
554
|
+
File.stubs(:directory?).returns(false)
|
555
|
+
@klass::HOME_SUBDIRS.each do |subdir|
|
556
|
+
FileUtils.expects(:mkdir_p).with(@env.home_path.join(subdir)).in_sequence(create_seq)
|
557
|
+
end
|
558
|
+
|
559
|
+
@env.load_home_directory!
|
560
|
+
end
|
561
|
+
|
562
|
+
should "not create directories if they exist" do
|
563
|
+
File.stubs(:directory?).returns(true)
|
564
|
+
FileUtils.expects(:mkdir_p).never
|
565
|
+
@env.load_home_directory!
|
566
|
+
end
|
567
|
+
end
|
568
|
+
|
569
|
+
context "loading the UUID out from the persisted dotfile" do
|
570
|
+
setup do
|
571
|
+
@env = vagrant_env
|
572
|
+
end
|
573
|
+
|
574
|
+
should "load all the VMs from the dotfile" do
|
575
|
+
@env.local_data[:active] = { "foo" => "bar", "bar" => "baz" }
|
576
|
+
|
577
|
+
results = {}
|
578
|
+
@env.local_data[:active].each do |key, value|
|
579
|
+
vm = mock("vm#{key}")
|
580
|
+
Vagrant::VM.expects(:find).with(value, @env, key.to_sym).returns(vm)
|
581
|
+
results[key.to_sym] = vm
|
582
|
+
end
|
583
|
+
|
584
|
+
returned = @env.load_vms!
|
585
|
+
|
586
|
+
results.each do |key, value|
|
587
|
+
assert_equal value, returned[key]
|
588
|
+
end
|
589
|
+
end
|
590
|
+
|
591
|
+
should "uuid should be nil if local data contains nothing" do
|
592
|
+
assert @env.local_data.empty? # sanity
|
593
|
+
@env.load_vms!
|
594
|
+
assert_nil @env.vm
|
595
|
+
end
|
596
|
+
end
|
597
|
+
end
|
598
|
+
end
|