vagrant 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -4
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/bin/vagrant +5 -13
- data/config/default.rb +1 -0
- data/keys/README.md +8 -1
- data/keys/vagrant.ppk +26 -0
- data/lib/vagrant.rb +3 -3
- data/lib/vagrant/actions/base.rb +15 -4
- data/lib/vagrant/actions/box/add.rb +1 -1
- data/lib/vagrant/actions/box/download.rb +72 -66
- data/lib/vagrant/actions/box/unpackage.rb +1 -4
- data/lib/vagrant/actions/runner.rb +1 -1
- data/lib/vagrant/actions/vm/boot.rb +5 -7
- data/lib/vagrant/actions/vm/customize.rb +2 -2
- data/lib/vagrant/actions/vm/destroy.rb +2 -2
- data/lib/vagrant/actions/vm/down.rb +7 -0
- data/lib/vagrant/actions/vm/export.rb +10 -4
- data/lib/vagrant/actions/vm/forward_ports.rb +5 -15
- data/lib/vagrant/actions/vm/halt.rb +5 -3
- data/lib/vagrant/actions/vm/import.rb +10 -3
- data/lib/vagrant/actions/vm/move_hard_drive.rb +1 -3
- data/lib/vagrant/actions/vm/package.rb +33 -10
- data/lib/vagrant/actions/vm/provision.rb +4 -4
- data/lib/vagrant/actions/vm/reload.rb +1 -1
- data/lib/vagrant/actions/vm/resume.rb +1 -1
- data/lib/vagrant/actions/vm/shared_folders.rb +7 -7
- data/lib/vagrant/actions/vm/start.rb +3 -2
- data/lib/vagrant/actions/vm/suspend.rb +2 -2
- data/lib/vagrant/actions/vm/up.rb +7 -17
- data/lib/vagrant/active_list.rb +52 -45
- data/lib/vagrant/box.rb +18 -11
- data/lib/vagrant/busy.rb +7 -0
- data/lib/vagrant/command.rb +27 -0
- data/lib/vagrant/commands/base.rb +163 -0
- data/lib/vagrant/commands/box.rb +16 -0
- data/lib/vagrant/commands/box/add.rb +24 -0
- data/lib/vagrant/commands/box/list.rb +30 -0
- data/lib/vagrant/commands/box/remove.rb +31 -0
- data/lib/vagrant/commands/destroy.rb +23 -0
- data/lib/vagrant/commands/down.rb +16 -0
- data/lib/vagrant/commands/halt.rb +23 -0
- data/lib/vagrant/commands/init.rb +32 -0
- data/lib/vagrant/commands/package.rb +46 -0
- data/lib/vagrant/commands/reload.rb +22 -0
- data/lib/vagrant/commands/resume.rb +22 -0
- data/lib/vagrant/commands/ssh.rb +22 -0
- data/lib/vagrant/commands/ssh_config.rb +30 -0
- data/lib/vagrant/commands/status.rb +58 -0
- data/lib/vagrant/commands/suspend.rb +23 -0
- data/lib/vagrant/commands/up.rb +26 -0
- data/lib/vagrant/config.rb +21 -11
- data/lib/vagrant/downloaders/file.rb +5 -5
- data/lib/vagrant/downloaders/http.rb +10 -15
- data/lib/vagrant/environment.rb +259 -0
- data/lib/vagrant/provisioners/base.rb +7 -0
- data/lib/vagrant/provisioners/chef.rb +24 -9
- data/lib/vagrant/provisioners/chef_server.rb +23 -48
- data/lib/vagrant/provisioners/chef_solo.rb +48 -22
- data/lib/vagrant/ssh.rb +95 -46
- data/lib/vagrant/util.rb +2 -2
- data/lib/vagrant/util/errors.rb +36 -0
- data/lib/vagrant/util/platform.rb +12 -0
- data/lib/vagrant/util/progress_meter.rb +33 -0
- data/lib/vagrant/util/stacked_proc_runner.rb +35 -0
- data/lib/vagrant/util/template_renderer.rb +83 -0
- data/lib/vagrant/vm.rb +1 -0
- data/templates/{Vagrantfile → Vagrantfile.erb} +2 -2
- data/templates/chef_server_client.erb +16 -0
- data/templates/chef_solo_solo.erb +4 -0
- data/templates/errors.yml +157 -0
- data/templates/package_Vagrantfile.erb +11 -0
- data/templates/ssh_config.erb +7 -0
- data/test/test_helper.rb +12 -15
- data/test/vagrant/actions/box/add_test.rb +1 -2
- data/test/vagrant/actions/box/destroy_test.rb +0 -1
- data/test/vagrant/actions/box/download_test.rb +40 -15
- data/test/vagrant/actions/box/unpackage_test.rb +2 -3
- data/test/vagrant/actions/collection_test.rb +8 -5
- data/test/vagrant/actions/runner_test.rb +8 -6
- data/test/vagrant/actions/vm/boot_test.rb +12 -11
- data/test/vagrant/actions/vm/customize_test.rb +2 -3
- data/test/vagrant/actions/vm/destroy_test.rb +2 -3
- data/test/vagrant/actions/vm/down_test.rb +16 -3
- data/test/vagrant/actions/vm/export_test.rb +4 -5
- data/test/vagrant/actions/vm/forward_ports_test.rb +6 -5
- data/test/vagrant/actions/vm/halt_test.rb +8 -2
- data/test/vagrant/actions/vm/import_test.rb +5 -5
- data/test/vagrant/actions/vm/move_hard_drive_test.rb +4 -6
- data/test/vagrant/actions/vm/package_test.rb +60 -22
- data/test/vagrant/actions/vm/provision_test.rb +7 -16
- data/test/vagrant/actions/vm/reload_test.rb +3 -2
- data/test/vagrant/actions/vm/resume_test.rb +0 -1
- data/test/vagrant/actions/vm/shared_folders_test.rb +17 -12
- data/test/vagrant/actions/vm/start_test.rb +10 -3
- data/test/vagrant/actions/vm/suspend_test.rb +1 -2
- data/test/vagrant/actions/vm/up_test.rb +19 -11
- data/test/vagrant/active_list_test.rb +148 -129
- data/test/vagrant/box_test.rb +26 -14
- data/test/vagrant/busy_test.rb +15 -6
- data/test/vagrant/command_test.rb +53 -0
- data/test/vagrant/commands/base_test.rb +118 -0
- data/test/vagrant/commands/box/add_test.rb +34 -0
- data/test/vagrant/commands/box/list_test.rb +32 -0
- data/test/vagrant/commands/box/remove_test.rb +41 -0
- data/test/vagrant/commands/destroy_test.rb +32 -0
- data/test/vagrant/commands/down_test.rb +17 -0
- data/test/vagrant/commands/halt_test.rb +28 -0
- data/test/vagrant/commands/init_test.rb +55 -0
- data/test/vagrant/commands/package_test.rb +84 -0
- data/test/vagrant/commands/reload_test.rb +28 -0
- data/test/vagrant/commands/resume_test.rb +33 -0
- data/test/vagrant/commands/ssh_config_test.rb +54 -0
- data/test/vagrant/commands/ssh_test.rb +32 -0
- data/test/vagrant/commands/status_test.rb +20 -0
- data/test/vagrant/commands/suspend_test.rb +33 -0
- data/test/vagrant/commands/up_test.rb +41 -0
- data/test/vagrant/config_test.rb +42 -17
- data/test/vagrant/downloaders/file_test.rb +7 -0
- data/test/vagrant/downloaders/http_test.rb +12 -0
- data/test/vagrant/environment_test.rb +595 -0
- data/test/vagrant/provisioners/base_test.rb +7 -1
- data/test/vagrant/provisioners/chef_server_test.rb +41 -51
- data/test/vagrant/provisioners/chef_solo_test.rb +93 -62
- data/test/vagrant/provisioners/chef_test.rb +61 -15
- data/test/vagrant/ssh_test.rb +166 -38
- data/test/vagrant/util/errors_test.rb +57 -0
- data/test/vagrant/util/progress_meter_test.rb +33 -0
- data/test/vagrant/{stacked_proc_runner_test.rb → util/stacked_proc_runner_test.rb} +3 -3
- data/test/vagrant/util/template_renderer_test.rb +138 -0
- data/test/vagrant/vm_test.rb +3 -2
- data/vagrant.gemspec +88 -33
- metadata +94 -51
- data/bin/vagrant-box +0 -34
- data/bin/vagrant-down +0 -27
- data/bin/vagrant-halt +0 -28
- data/bin/vagrant-init +0 -27
- data/bin/vagrant-package +0 -29
- data/bin/vagrant-reload +0 -29
- data/bin/vagrant-resume +0 -27
- data/bin/vagrant-ssh +0 -27
- data/bin/vagrant-status +0 -29
- data/bin/vagrant-suspend +0 -27
- data/bin/vagrant-up +0 -29
- data/lib/vagrant/commands.rb +0 -234
- data/lib/vagrant/env.rb +0 -189
- data/lib/vagrant/stacked_proc_runner.rb +0 -33
- data/test/vagrant/commands_test.rb +0 -269
- data/test/vagrant/env_test.rb +0 -418
data/Gemfile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
source :gemcutter
|
2
2
|
|
3
3
|
# Gems required for the lib to even run
|
4
|
-
gem "virtualbox", "
|
4
|
+
gem "virtualbox", "~> 0.6.0"
|
5
5
|
gem "net-ssh", ">= 2.0.19"
|
6
6
|
gem "net-scp", ">= 1.0.2"
|
7
|
-
gem "
|
8
|
-
gem "
|
9
|
-
gem "
|
7
|
+
gem "json_pure", ">= 1.2.0"
|
8
|
+
gem "archive-tar-minitar", "= 0.5.2"
|
9
|
+
gem "mario", "~> 0.0.6"
|
10
10
|
|
11
11
|
# Gems required for testing only. To install run
|
12
12
|
# gem bundle test
|
data/Rakefile
CHANGED
@@ -10,12 +10,12 @@ begin
|
|
10
10
|
gemspec.homepage = "http://github.com/mitchellh/vagrant"
|
11
11
|
gemspec.authors = ["Mitchell Hashimoto", "John Bender"]
|
12
12
|
|
13
|
-
gemspec.add_dependency('virtualbox', '
|
13
|
+
gemspec.add_dependency('virtualbox', '~> 0.6.0')
|
14
14
|
gemspec.add_dependency('net-ssh', '>= 2.0.19')
|
15
15
|
gemspec.add_dependency('net-scp', '>= 1.0.2')
|
16
|
-
gemspec.add_dependency('
|
17
|
-
gemspec.add_dependency('git-style-binaries', '>= 0.1.10')
|
16
|
+
gemspec.add_dependency('json_pure', '>= 1.2.0')
|
18
17
|
gemspec.add_dependency('archive-tar-minitar', '= 0.5.2')
|
18
|
+
gemspec.add_dependency('mario', '~> 0.0.6')
|
19
19
|
end
|
20
20
|
Jeweler::GemcutterTasks.new
|
21
21
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/bin/vagrant
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
# Fallback on rubygems
|
6
|
-
require "rubygems"
|
7
|
-
end
|
2
|
+
# Get library
|
3
|
+
libdir = File.join(File.dirname(__FILE__), '..', 'lib')
|
4
|
+
require File.expand_path('vagrant', libdir)
|
8
5
|
|
9
|
-
|
10
|
-
|
11
|
-
GitStyleBinary.primary do
|
12
|
-
version "0.2.0"
|
13
|
-
|
14
|
-
run { educate }
|
15
|
-
end
|
6
|
+
# Call the command
|
7
|
+
Vagrant::Command.execute(*ARGV)
|
data/config/default.rb
CHANGED
data/keys/README.md
CHANGED
@@ -7,4 +7,11 @@ vagrant installations can automatically SSH into the boxes.
|
|
7
7
|
If you're working with a team or company or with a custom box and
|
8
8
|
you want more secure SSH, you should create your own keypair
|
9
9
|
and configure the private key in the Vagrantfile with
|
10
|
-
`config.ssh.private_key_path`
|
10
|
+
`config.ssh.private_key_path`
|
11
|
+
|
12
|
+
# Putty
|
13
|
+
|
14
|
+
If you are using Vagrant on windows, the .ppk file contained here, in the keys directory,
|
15
|
+
has been generated from the private key and should be used to connect Putty to any VMs that
|
16
|
+
are leveraging the default key pair. See [guide](http://vagrantup.com/docs/getting-started/windows.html)
|
17
|
+
in the documentation for more details on using Putty with Vagrant.
|
data/keys/vagrant.ppk
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
PuTTY-User-Key-File-2: ssh-rsa
|
2
|
+
Encryption: none
|
3
|
+
Comment: imported-openssh-key
|
4
|
+
Public-Lines: 6
|
5
|
+
AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+k
|
6
|
+
z4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdO
|
7
|
+
KLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4
|
8
|
+
O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGj
|
9
|
+
yiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPK
|
10
|
+
cF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ==
|
11
|
+
Private-Lines: 14
|
12
|
+
AAABAQDiKpY8le3NkDryYp0QuziMmx3KTL57B1l412zm2NycdTnNRgTbkr598kQP
|
13
|
+
2pRYgJwtkNzzVMZaMfICoPUHDtemBTAWB5QnBSXNC6sC/7/JKfGLC5oYl+EUzUJp
|
14
|
+
AfN9emGBWaX59lS+clRO/N9MrYuDoR1tQT1NqtSUF//E9+4SExKUgTmR5v9nPf8t
|
15
|
+
SVGDzIOrPnD5BZUni62cqcqKrBk3SbCnBTthLImGVPhhXUXefhiMuzAznAmzaiqb
|
16
|
+
SOyxC78FPS3IRc0NgEsQXgCwKVpa5InaSOrsqGuthfNqCqGdJ6L04NgVKEm7xRZV
|
17
|
+
5zciFvlleXM7q901DUn1ex/ib7bLAAAAgQD6qFxx/Rv9CNN96l/4rb14HKirC2o/
|
18
|
+
orApiHmHDsURs5rUKDx0f9iPcXN7S1uePXuJRK/5hsubaOCx3Owd2u9gD6Oq0CsM
|
19
|
+
kE4CUSiJcYrMANtx54cGH7RkEjFZxK8xAv1ldELEyxrFqkbE4BKd8QOt414qjvTG
|
20
|
+
yAK+OLD3M2QdCQAAAIEA7cfKTQgMUe8oR2yFk9QB+uvl1jfG16u5d0Tv7pHmnIvf
|
21
|
+
CX5G5MVEWYbcVfxx7r1IZzy3V908MoDwWGRTaOKc1RIc1qE7ZxLaxbniscnN/i42
|
22
|
+
abqPpgZUOjkbX4JK/YAVaYV2RmBM5Ag95VXZfC+HMPQVaSqyQrNXObWhow4HSJ0A
|
23
|
+
AACANWrLCz708y7VYgAtW2Uf1DPOIYMdvo6fxIB5i9ZfISgcJ/bbCUkFrhoH+vq/
|
24
|
+
5CIWxCPp0f85R4qxxQ5ihxJ0YDQT9Jpx4TMss4PSavPaBH3RXow5Ohe+bYoQNE5O
|
25
|
+
gEXk2wVfZczCZpigBKbKZHNYcelXtTt/nP3rsCuGcM4h53s=
|
26
|
+
Private-MAC: bc710f345e67c736d57dd72aab10fe4625345dae
|
data/lib/vagrant.rb
CHANGED
@@ -3,13 +3,13 @@ PROJECT_ROOT = File.join(libdir, '..') unless defined?(PROJECT_ROOT)
|
|
3
3
|
|
4
4
|
# The libs which must be loaded prior to the rest
|
5
5
|
%w{tempfile open-uri json pathname logger uri net/http virtualbox net/ssh archive/tar/minitar
|
6
|
-
net/scp fileutils}.each do |lib|
|
6
|
+
net/scp fileutils mario}.each do |lib|
|
7
7
|
require lib
|
8
8
|
end
|
9
9
|
|
10
10
|
# The vagrant specific files which must be loaded prior to the rest
|
11
|
-
%w{vagrant/util vagrant/stacked_proc_runner vagrant/actions/base vagrant/downloaders/base vagrant/actions/collection
|
12
|
-
vagrant/actions/runner vagrant/config vagrant/provisioners/base vagrant/provisioners/chef}.each do |f|
|
11
|
+
%w{vagrant/util vagrant/util/stacked_proc_runner vagrant/util/progress_meter vagrant/actions/base vagrant/downloaders/base vagrant/actions/collection
|
12
|
+
vagrant/actions/runner vagrant/config vagrant/provisioners/base vagrant/provisioners/chef vagrant/commands/base vagrant/commands/box}.each do |f|
|
13
13
|
require File.expand_path(f, libdir)
|
14
14
|
end
|
15
15
|
|
data/lib/vagrant/actions/base.rb
CHANGED
@@ -84,15 +84,15 @@ module Vagrant
|
|
84
84
|
def rescue(exception); end
|
85
85
|
|
86
86
|
# The following two methods are used for declaring action dependencies.
|
87
|
-
# For example, you require that the reload action be in place before
|
87
|
+
# For example, you require that the reload action be in place before
|
88
88
|
# a your new FooAction you might do the following
|
89
89
|
#
|
90
90
|
# def follows; [Reload] end
|
91
|
-
|
91
|
+
|
92
92
|
# This method is called when the runner is determining the actions that
|
93
93
|
# must precede a given action. You would say "This action follows [Action1, Action2]"
|
94
94
|
def follows; [] end
|
95
|
-
|
95
|
+
|
96
96
|
# This method is called when the runner is determining the actions that
|
97
97
|
# must follow a given action. You would say "This action precedes [Action3, Action4]
|
98
98
|
def precedes; [] end
|
@@ -102,6 +102,17 @@ module Vagrant
|
|
102
102
|
# {Vagrant::Util#error_and_exit error_and_exit}, since it allows the {Runner} to call
|
103
103
|
# {Base#rescue rescue} on all the actions and properly exit. Any message
|
104
104
|
# passed into the {ActionException} is then shown and and vagrant exits.
|
105
|
-
class ActionException < Exception
|
105
|
+
class ActionException < Exception
|
106
|
+
attr_reader :key
|
107
|
+
attr_reader :data
|
108
|
+
|
109
|
+
def initialize(key, data = {})
|
110
|
+
@key = key
|
111
|
+
@data = data
|
112
|
+
|
113
|
+
message = Vagrant::Util::Errors.error_string(key, data)
|
114
|
+
super(message)
|
115
|
+
end
|
116
|
+
end
|
106
117
|
end
|
107
118
|
end
|
@@ -10,7 +10,7 @@ module Vagrant
|
|
10
10
|
class Add < Base
|
11
11
|
def prepare
|
12
12
|
if File.exists?(@runner.directory)
|
13
|
-
raise ActionException.new(
|
13
|
+
raise ActionException.new(:box_add_already_exists, :box_name => @runner.name)
|
14
14
|
end
|
15
15
|
|
16
16
|
@runner.add_action(Download)
|
@@ -1,66 +1,72 @@
|
|
1
|
-
module Vagrant
|
2
|
-
module Actions
|
3
|
-
module Box
|
4
|
-
# An action which acts on a box by downloading the box file from
|
5
|
-
# the given URI into a temporary location. This action parses a
|
6
|
-
# given URI and handles downloading it via one of the many Vagrant
|
7
|
-
# downloads (such as {Vagrant::Downloaders::File}).
|
8
|
-
#
|
9
|
-
# This action cleans itself up by removing the downloaded box file.
|
10
|
-
class Download < Base
|
11
|
-
BASENAME = "box"
|
12
|
-
BUFFERSIZE = 1048576 # 1 MB
|
13
|
-
|
14
|
-
attr_reader :downloader
|
15
|
-
|
16
|
-
def prepare
|
17
|
-
#
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
1
|
+
module Vagrant
|
2
|
+
module Actions
|
3
|
+
module Box
|
4
|
+
# An action which acts on a box by downloading the box file from
|
5
|
+
# the given URI into a temporary location. This action parses a
|
6
|
+
# given URI and handles downloading it via one of the many Vagrant
|
7
|
+
# downloads (such as {Vagrant::Downloaders::File}).
|
8
|
+
#
|
9
|
+
# This action cleans itself up by removing the downloaded box file.
|
10
|
+
class Download < Base
|
11
|
+
BASENAME = "box"
|
12
|
+
BUFFERSIZE = 1048576 # 1 MB
|
13
|
+
|
14
|
+
attr_reader :downloader
|
15
|
+
|
16
|
+
def prepare
|
17
|
+
# Check the URI given and prepare a downloader
|
18
|
+
[Downloaders::HTTP, Downloaders::File].each do |dler|
|
19
|
+
if dler.match?(@runner.uri)
|
20
|
+
logger.info "Downloading via #{dler}..."
|
21
|
+
@downloader = dler.new
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
raise ActionException.new(:box_download_unknown_type) unless @downloader
|
26
|
+
|
27
|
+
# Prepare the downloader
|
28
|
+
@downloader.prepare(@runner.uri)
|
29
|
+
end
|
30
|
+
|
31
|
+
def execute!
|
32
|
+
with_tempfile do |tempfile|
|
33
|
+
download_to(tempfile)
|
34
|
+
@runner.temp_path = tempfile.path
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def cleanup
|
39
|
+
if @runner.temp_path && File.exist?(@runner.temp_path)
|
40
|
+
logger.info "Cleaning up downloaded box..."
|
41
|
+
File.unlink(@runner.temp_path)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def rescue(exception)
|
46
|
+
cleanup
|
47
|
+
end
|
48
|
+
|
49
|
+
def with_tempfile
|
50
|
+
logger.info "Creating tempfile for storing box file..."
|
51
|
+
File.open(box_temp_path, file_options) do |tempfile|
|
52
|
+
yield tempfile
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def file_options
|
57
|
+
# create, write only, fail if the file exists, binary if windows
|
58
|
+
File::WRONLY|File::EXCL|File::CREAT|(Mario::Platform.windows? ? File::BINARY : 0)
|
59
|
+
end
|
60
|
+
|
61
|
+
def box_temp_path
|
62
|
+
File.join(@runner.env.tmp_path, BASENAME + Time.now.to_i.to_s)
|
63
|
+
end
|
64
|
+
|
65
|
+
def download_to(f)
|
66
|
+
logger.info "Copying box to temporary location..."
|
67
|
+
downloader.download!(@runner.uri, f)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -21,10 +21,7 @@ module Vagrant
|
|
21
21
|
|
22
22
|
def setup_box_dir
|
23
23
|
if File.directory?(box_dir)
|
24
|
-
error_and_exit(
|
25
|
-
This box appears to already exist! Please call `vagrant box remove #{@runner.name}`
|
26
|
-
and then try to add it again.
|
27
|
-
msg
|
24
|
+
error_and_exit(:box_already_exists, :box_name => @runner.name)
|
28
25
|
end
|
29
26
|
|
30
27
|
FileUtils.mkdir_p(box_dir)
|
@@ -3,7 +3,7 @@ module Vagrant
|
|
3
3
|
module VM
|
4
4
|
class Boot < Base
|
5
5
|
def prepare
|
6
|
-
|
6
|
+
@runner.env.config.vm.share_folder("v-root", @runner.env.config.vm.project_directory, @runner.env.root_path)
|
7
7
|
end
|
8
8
|
|
9
9
|
def execute!
|
@@ -14,25 +14,23 @@ module Vagrant
|
|
14
14
|
# Wait for it to complete booting, or error if we could
|
15
15
|
# never detect it booted up successfully
|
16
16
|
if !wait_for_boot
|
17
|
-
error_and_exit(
|
18
|
-
Failed to connect to VM! Failed to boot?
|
19
|
-
error
|
17
|
+
error_and_exit(:vm_failed_to_boot)
|
20
18
|
end
|
21
19
|
end
|
22
20
|
end
|
23
21
|
|
24
22
|
def boot
|
25
23
|
logger.info "Booting VM..."
|
26
|
-
@runner.vm.start(
|
24
|
+
@runner.vm.start(@runner.env.config.vm.boot_mode)
|
27
25
|
end
|
28
26
|
|
29
27
|
def wait_for_boot(sleeptime=5)
|
30
28
|
logger.info "Waiting for VM to boot..."
|
31
29
|
|
32
|
-
|
30
|
+
@runner.env.config.ssh.max_tries.to_i.times do |i|
|
33
31
|
logger.info "Trying to connect (attempt ##{i+1} of #{Vagrant.config[:ssh][:max_tries]})..."
|
34
32
|
|
35
|
-
if
|
33
|
+
if @runner.env.ssh.up?
|
36
34
|
logger.info "VM booted and ready for use!"
|
37
35
|
return true
|
38
36
|
end
|
@@ -6,10 +6,10 @@ module Vagrant
|
|
6
6
|
logger.info "Running any VM customizations..."
|
7
7
|
|
8
8
|
# Run the customization procs over the VM
|
9
|
-
|
9
|
+
@runner.env.config.vm.run_procs!(@runner.vm)
|
10
10
|
|
11
11
|
# Save the vm
|
12
|
-
@runner.vm.save
|
12
|
+
@runner.vm.save
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -11,11 +11,11 @@ module Vagrant
|
|
11
11
|
|
12
12
|
def destroy_vm
|
13
13
|
logger.info "Destroying VM and associated drives..."
|
14
|
-
@runner.vm.destroy(:
|
14
|
+
@runner.vm.destroy(:destroy_medium => :delete)
|
15
15
|
end
|
16
16
|
|
17
17
|
def depersist
|
18
|
-
|
18
|
+
@runner.env.depersist_vm
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -6,6 +6,13 @@ module Vagrant
|
|
6
6
|
@runner.add_action(Halt) if @runner.vm.running?
|
7
7
|
@runner.add_action(Destroy)
|
8
8
|
end
|
9
|
+
|
10
|
+
def after_halt
|
11
|
+
# This sleep is necessary to wait for the GUI to clean itself up.
|
12
|
+
# There appears to be nothing in the API that does this "wait"
|
13
|
+
# for us.
|
14
|
+
Kernel.sleep(1) if @runner.env.config.vm.boot_mode == "gui"
|
15
|
+
end
|
9
16
|
end
|
10
17
|
end
|
11
18
|
end
|
@@ -2,6 +2,8 @@ module Vagrant
|
|
2
2
|
module Actions
|
3
3
|
module VM
|
4
4
|
class Export < Base
|
5
|
+
include Util::ProgressMeter
|
6
|
+
|
5
7
|
attr_reader :temp_dir
|
6
8
|
|
7
9
|
def execute!
|
@@ -21,19 +23,23 @@ module Vagrant
|
|
21
23
|
end
|
22
24
|
|
23
25
|
def setup_temp_dir
|
24
|
-
@temp_dir = File.join(
|
26
|
+
@temp_dir = File.join(@runner.env.tmp_path, Time.now.to_i.to_s)
|
25
27
|
|
26
28
|
logger.info "Creating temporary directory for export..."
|
27
29
|
FileUtils.mkpath(temp_dir)
|
28
30
|
end
|
29
31
|
|
30
32
|
def ovf_path
|
31
|
-
File.join(temp_dir,
|
33
|
+
File.join(temp_dir, @runner.env.config.vm.box_ovf)
|
32
34
|
end
|
33
35
|
|
34
36
|
def export
|
35
|
-
logger.info "Exporting VM to #{ovf_path}
|
36
|
-
@runner.vm.export(ovf_path
|
37
|
+
logger.info "Exporting VM to #{ovf_path}..."
|
38
|
+
@runner.vm.export(ovf_path) do |progress|
|
39
|
+
update_progress(progress, 100, false)
|
40
|
+
end
|
41
|
+
|
42
|
+
complete_progress
|
37
43
|
end
|
38
44
|
end
|
39
45
|
end
|