vagrant 0.3.4 → 0.4.0
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/Gemfile +2 -2
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/config/default.rb +13 -3
- data/lib/vagrant.rb +10 -13
- data/lib/vagrant/actions/base.rb +14 -2
- data/lib/vagrant/actions/box/download.rb +2 -7
- data/lib/vagrant/actions/box/verify.rb +1 -1
- data/lib/vagrant/actions/runner.rb +0 -1
- data/lib/vagrant/actions/vm/boot.rb +2 -6
- data/lib/vagrant/actions/vm/customize.rb +7 -5
- data/lib/vagrant/actions/vm/destroy.rb +4 -3
- data/lib/vagrant/actions/vm/down.rb +6 -3
- data/lib/vagrant/actions/vm/export.rb +2 -4
- data/lib/vagrant/actions/vm/forward_ports.rb +77 -16
- data/lib/vagrant/actions/vm/halt.rb +10 -2
- data/lib/vagrant/actions/vm/import.rb +2 -4
- data/lib/vagrant/actions/vm/move_hard_drive.rb +2 -2
- data/lib/vagrant/actions/vm/network.rb +120 -0
- data/lib/vagrant/actions/vm/package.rb +11 -7
- data/lib/vagrant/actions/vm/provision.rb +3 -3
- data/lib/vagrant/actions/vm/reload.rb +2 -9
- data/lib/vagrant/actions/vm/shared_folders.rb +19 -39
- data/lib/vagrant/actions/vm/start.rb +10 -2
- data/lib/vagrant/actions/vm/up.rb +5 -6
- data/lib/vagrant/active_list.rb +23 -13
- data/lib/vagrant/box.rb +2 -2
- data/lib/vagrant/busy.rb +3 -3
- data/lib/vagrant/command.rb +2 -2
- data/lib/vagrant/commands/base.rb +40 -20
- data/lib/vagrant/commands/destroy.rb +17 -3
- data/lib/vagrant/commands/halt.rb +23 -3
- data/lib/vagrant/commands/package.rb +54 -14
- data/lib/vagrant/commands/provision.rb +31 -0
- data/lib/vagrant/commands/reload.rb +16 -3
- data/lib/vagrant/commands/resume.rb +16 -3
- data/lib/vagrant/commands/ssh.rb +25 -3
- data/lib/vagrant/commands/ssh_config.rb +20 -5
- data/lib/vagrant/commands/status.rb +107 -40
- data/lib/vagrant/commands/suspend.rb +16 -3
- data/lib/vagrant/commands/up.rb +26 -7
- data/lib/vagrant/config.rb +82 -12
- data/lib/vagrant/downloaders/base.rb +8 -1
- data/lib/vagrant/downloaders/http.rb +31 -19
- data/lib/vagrant/environment.rb +146 -49
- data/lib/vagrant/provisioners/base.rb +19 -5
- data/lib/vagrant/provisioners/chef.rb +12 -4
- data/lib/vagrant/provisioners/chef_server.rb +13 -6
- data/lib/vagrant/provisioners/chef_solo.rb +7 -3
- data/lib/vagrant/resource_logger.rb +126 -0
- data/lib/vagrant/ssh.rb +109 -8
- data/lib/vagrant/systems/base.rb +70 -0
- data/lib/vagrant/systems/linux.rb +137 -0
- data/lib/vagrant/util.rb +1 -45
- data/lib/vagrant/util/error_helper.rb +13 -0
- data/lib/vagrant/util/glob_loader.rb +22 -0
- data/lib/vagrant/util/output_helper.rb +9 -0
- data/lib/vagrant/util/plain_logger.rb +12 -0
- data/lib/vagrant/util/platform.rb +7 -2
- data/lib/vagrant/util/template_renderer.rb +2 -2
- data/lib/vagrant/util/translator.rb +35 -0
- data/lib/vagrant/vm.rb +91 -10
- data/templates/crontab_entry.erb +1 -0
- data/templates/network_entry.erb +8 -0
- data/templates/ssh_config.erb +1 -0
- data/templates/{errors.yml → strings.yml} +111 -3
- data/templates/sync.erb +14 -0
- data/test/test_helper.rb +46 -3
- data/test/vagrant/actions/box/download_test.rb +0 -17
- data/test/vagrant/actions/vm/boot_test.rb +3 -10
- data/test/vagrant/actions/vm/customize_test.rb +6 -0
- data/test/vagrant/actions/vm/destroy_test.rb +6 -5
- data/test/vagrant/actions/vm/down_test.rb +5 -11
- data/test/vagrant/actions/vm/export_test.rb +1 -0
- data/test/vagrant/actions/vm/forward_ports_test.rb +92 -15
- data/test/vagrant/actions/vm/halt_test.rb +36 -4
- data/test/vagrant/actions/vm/import_test.rb +2 -0
- data/test/vagrant/actions/vm/network_test.rb +237 -0
- data/test/vagrant/actions/vm/package_test.rb +35 -5
- data/test/vagrant/actions/vm/provision_test.rb +3 -3
- data/test/vagrant/actions/vm/reload_test.rb +1 -1
- data/test/vagrant/actions/vm/shared_folders_test.rb +41 -74
- data/test/vagrant/actions/vm/start_test.rb +41 -3
- data/test/vagrant/actions/vm/up_test.rb +10 -21
- data/test/vagrant/active_list_test.rb +28 -43
- data/test/vagrant/commands/base_test.rb +25 -4
- data/test/vagrant/commands/destroy_test.rb +24 -12
- data/test/vagrant/commands/halt_test.rb +33 -11
- data/test/vagrant/commands/package_test.rb +77 -57
- data/test/vagrant/commands/provision_test.rb +50 -0
- data/test/vagrant/commands/reload_test.rb +27 -11
- data/test/vagrant/commands/resume_test.rb +25 -14
- data/test/vagrant/commands/ssh_config_test.rb +40 -17
- data/test/vagrant/commands/ssh_test.rb +52 -13
- data/test/vagrant/commands/status_test.rb +21 -1
- data/test/vagrant/commands/suspend_test.rb +25 -14
- data/test/vagrant/commands/up_test.rb +25 -19
- data/test/vagrant/config_test.rb +74 -18
- data/test/vagrant/downloaders/base_test.rb +2 -1
- data/test/vagrant/downloaders/http_test.rb +18 -8
- data/test/vagrant/environment_test.rb +245 -77
- data/test/vagrant/provisioners/base_test.rb +4 -4
- data/test/vagrant/provisioners/chef_server_test.rb +18 -7
- data/test/vagrant/provisioners/chef_solo_test.rb +17 -7
- data/test/vagrant/provisioners/chef_test.rb +22 -9
- data/test/vagrant/resource_logger_test.rb +144 -0
- data/test/vagrant/ssh_session_test.rb +46 -0
- data/test/vagrant/ssh_test.rb +42 -2
- data/test/vagrant/systems/linux_test.rb +174 -0
- data/test/vagrant/util/error_helper_test.rb +5 -0
- data/test/vagrant/util/output_helper_test.rb +5 -0
- data/test/vagrant/util/plain_logger_test.rb +17 -0
- data/test/vagrant/util/platform_test.rb +18 -0
- data/test/vagrant/util/{errors_test.rb → translator_test.rb} +25 -21
- data/test/vagrant/util_test.rb +12 -49
- data/test/vagrant/vm_test.rb +133 -11
- data/vagrant.gemspec +39 -15
- metadata +64 -40
- data/lib/vagrant/commands/down.rb +0 -16
- data/lib/vagrant/util/errors.rb +0 -36
- data/lib/vagrant/util/progress_meter.rb +0 -33
- data/test/vagrant/commands/down_test.rb +0 -17
- data/test/vagrant/util/progress_meter_test.rb +0 -33
data/lib/vagrant/box.rb
CHANGED
@@ -56,7 +56,7 @@ module Vagrant
|
|
56
56
|
# of a specific instance.
|
57
57
|
attr_accessor :env
|
58
58
|
|
59
|
-
class <<self
|
59
|
+
class << self
|
60
60
|
# Returns an array of all created boxes, as strings.
|
61
61
|
#
|
62
62
|
# @return [Array<String>]
|
@@ -149,4 +149,4 @@ module Vagrant
|
|
149
149
|
self.class.directory(env, self.name)
|
150
150
|
end
|
151
151
|
end
|
152
|
-
end
|
152
|
+
end
|
data/lib/vagrant/busy.rb
CHANGED
@@ -45,7 +45,7 @@ module Vagrant
|
|
45
45
|
|
46
46
|
def wait_for_not_busy(sleeptime=5)
|
47
47
|
if @@trap_thread
|
48
|
-
logger.info "Exiting vagrant immediately!"
|
48
|
+
# logger.info "Exiting vagrant immediately!"
|
49
49
|
Thread.kill(@@trap_thread)
|
50
50
|
abort
|
51
51
|
return # for tests
|
@@ -55,12 +55,12 @@ module Vagrant
|
|
55
55
|
# Wait while the app is busy
|
56
56
|
loop do
|
57
57
|
break unless busy?
|
58
|
-
logger.info "Waiting for vagrant to clean itself up..."
|
58
|
+
# logger.info "Waiting for vagrant to clean itself up..."
|
59
59
|
sleep sleeptime
|
60
60
|
end
|
61
61
|
|
62
62
|
# Exit out of the entire script
|
63
|
-
logger.info "Exiting vagrant..."
|
63
|
+
# logger.info "Exiting vagrant..."
|
64
64
|
exit
|
65
65
|
end
|
66
66
|
end
|
data/lib/vagrant/command.rb
CHANGED
@@ -5,7 +5,7 @@ module Vagrant
|
|
5
5
|
class Command
|
6
6
|
attr_reader :env
|
7
7
|
|
8
|
-
class <<self
|
8
|
+
class << self
|
9
9
|
# Executes a given subcommand within the current environment (from the
|
10
10
|
# current working directory).
|
11
11
|
def execute(*args)
|
@@ -24,4 +24,4 @@ module Vagrant
|
|
24
24
|
Commands::Base.dispatch(env, *args)
|
25
25
|
end
|
26
26
|
end
|
27
|
-
end
|
27
|
+
end
|
@@ -12,7 +12,7 @@ module Vagrant
|
|
12
12
|
|
13
13
|
attr_reader :env
|
14
14
|
|
15
|
-
class <<self
|
15
|
+
class << self
|
16
16
|
# Contains the list of registered subcommands. The registered commands are
|
17
17
|
# stored in a hash table and are therefore unordered.
|
18
18
|
#
|
@@ -50,22 +50,6 @@ module Vagrant
|
|
50
50
|
klass.dispatch(env, *args)
|
51
51
|
end
|
52
52
|
|
53
|
-
# Prints out the list of supported commands and their descriptions (if
|
54
|
-
# available) then exits.
|
55
|
-
def puts_help
|
56
|
-
puts "Usage: vagrant SUBCOMMAND ...\n\n"
|
57
|
-
|
58
|
-
puts "Supported commands:"
|
59
|
-
subcommands.keys.sort.each do |key|
|
60
|
-
klass = subcommands[key]
|
61
|
-
next if klass.description.empty?
|
62
|
-
|
63
|
-
puts "#{' ' * 4}#{key.ljust(20)}#{klass.description}"
|
64
|
-
end
|
65
|
-
|
66
|
-
exit
|
67
|
-
end
|
68
|
-
|
69
53
|
# Sets or reads the description, depending on if the value is set in the
|
70
54
|
# parameter.
|
71
55
|
def description(value=nil)
|
@@ -92,7 +76,7 @@ module Vagrant
|
|
92
76
|
else
|
93
77
|
# Just print out the help, since this top-level command does nothing
|
94
78
|
# on its own
|
95
|
-
|
79
|
+
show_help
|
96
80
|
end
|
97
81
|
end
|
98
82
|
|
@@ -110,6 +94,23 @@ module Vagrant
|
|
110
94
|
# Methods below are not meant to be overriden/implemented by subclasses
|
111
95
|
#-------------------------------------------------------------------
|
112
96
|
|
97
|
+
# Parses the options for a given command and if a name was
|
98
|
+
# given, it calls the single method, otherwise it calls the all
|
99
|
+
# method. This helper is an abstraction which allows commands to
|
100
|
+
# easily be used in both regular and multi-VM environments.
|
101
|
+
def all_or_single(args, method_prefix)
|
102
|
+
args = parse_options(args)
|
103
|
+
|
104
|
+
single_method = "#{method_prefix}_single".to_sym
|
105
|
+
if args[0]
|
106
|
+
send(single_method, args[0])
|
107
|
+
else
|
108
|
+
env.vms.keys.each do |name|
|
109
|
+
send(single_method, name)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
113
114
|
# Shows the version
|
114
115
|
def puts_version
|
115
116
|
File.open(File.join(PROJECT_ROOT, "VERSION"), "r") do |f|
|
@@ -122,6 +123,12 @@ module Vagrant
|
|
122
123
|
def option_parser(reload=false)
|
123
124
|
@option_parser = nil if reload
|
124
125
|
@option_parser ||= OptionParser.new do |opts|
|
126
|
+
# The --help flag is available on all children commands, and will
|
127
|
+
# immediately show help.
|
128
|
+
opts.on("--help", "Show help for the current subcommand.") do
|
129
|
+
show_help
|
130
|
+
end
|
131
|
+
|
125
132
|
options_spec(opts)
|
126
133
|
end
|
127
134
|
end
|
@@ -136,7 +143,6 @@ module Vagrant
|
|
136
143
|
# to parse command line options.
|
137
144
|
def parse_options(args)
|
138
145
|
option_parser.parse!(args)
|
139
|
-
options
|
140
146
|
rescue OptionParser::InvalidOption
|
141
147
|
show_help
|
142
148
|
end
|
@@ -156,8 +162,22 @@ module Vagrant
|
|
156
162
|
end
|
157
163
|
|
158
164
|
puts option_parser.help
|
165
|
+
|
166
|
+
my_klass = self.class
|
167
|
+
if !my_klass.subcommands.empty?
|
168
|
+
puts "\nSupported subcommands:"
|
169
|
+
my_klass.subcommands.keys.sort.each do |key|
|
170
|
+
klass = my_klass.subcommands[key]
|
171
|
+
next if klass.description.empty?
|
172
|
+
|
173
|
+
puts "#{' ' * 8}#{key.ljust(20)}#{klass.description}"
|
174
|
+
end
|
175
|
+
|
176
|
+
puts "\nFor help on a specific subcommand, run `vagrant SUBCOMMAND --help`"
|
177
|
+
end
|
178
|
+
|
159
179
|
exit
|
160
180
|
end
|
161
181
|
end
|
162
182
|
end
|
163
|
-
end
|
183
|
+
end
|
@@ -11,8 +11,22 @@ module Vagrant
|
|
11
11
|
description "Destroys the vagrant environment"
|
12
12
|
|
13
13
|
def execute(args=[])
|
14
|
-
|
15
|
-
|
14
|
+
all_or_single(args, :destroy)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Destroys a single VM by name.
|
18
|
+
def destroy_single(name)
|
19
|
+
vm = env.vms[name.to_sym]
|
20
|
+
if vm.nil?
|
21
|
+
error_and_exit(:unknown_vm, :vm => name)
|
22
|
+
return # for tests
|
23
|
+
end
|
24
|
+
|
25
|
+
if vm.created?
|
26
|
+
vm.destroy
|
27
|
+
else
|
28
|
+
vm.env.logger.info "VM '#{name}' not created. Ignoring."
|
29
|
+
end
|
16
30
|
end
|
17
31
|
|
18
32
|
def options_spec(opts)
|
@@ -20,4 +34,4 @@ module Vagrant
|
|
20
34
|
end
|
21
35
|
end
|
22
36
|
end
|
23
|
-
end
|
37
|
+
end
|
@@ -11,13 +11,33 @@ module Vagrant
|
|
11
11
|
description "Halts the currently running vagrant environment"
|
12
12
|
|
13
13
|
def execute(args=[])
|
14
|
-
|
15
|
-
|
14
|
+
all_or_single(args, :halt)
|
15
|
+
end
|
16
|
+
|
17
|
+
def halt_single(name)
|
18
|
+
vm = env.vms[name.to_sym]
|
19
|
+
if vm.nil?
|
20
|
+
error_and_exit(:unknown_vm, :vm => name)
|
21
|
+
return # for tests
|
22
|
+
end
|
23
|
+
|
24
|
+
if vm.created?
|
25
|
+
vm.halt(options)
|
26
|
+
else
|
27
|
+
vm.env.logger.info "VM '#{name}' not created. Ignoring."
|
28
|
+
end
|
16
29
|
end
|
17
30
|
|
18
31
|
def options_spec(opts)
|
19
32
|
opts.banner = "Usage: vagrant halt"
|
33
|
+
|
34
|
+
# Defaults
|
35
|
+
options[:force] = false
|
36
|
+
|
37
|
+
opts.on("-f", "--force", "Forceful shutdown of virtual machine.") do |v|
|
38
|
+
options[:force] = true
|
39
|
+
end
|
20
40
|
end
|
21
41
|
end
|
22
42
|
end
|
23
|
-
end
|
43
|
+
end
|
@@ -8,23 +8,57 @@ module Vagrant
|
|
8
8
|
description "Packages a vagrant environment for distribution"
|
9
9
|
|
10
10
|
def execute(args=[])
|
11
|
-
parse_options(args)
|
11
|
+
args = parse_options(args)
|
12
12
|
|
13
|
-
if
|
14
|
-
|
15
|
-
env.require_persisted_vm
|
13
|
+
if options[:base]
|
14
|
+
package_base
|
16
15
|
else
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
vm.env = env if vm
|
21
|
-
env.vm = vm
|
16
|
+
package_single(args[0])
|
17
|
+
end
|
18
|
+
end
|
22
19
|
|
23
|
-
|
20
|
+
def package_base
|
21
|
+
# Packaging a base box; that is a VM not tied to a specific
|
22
|
+
# vagrant environment
|
23
|
+
vm = VM.find(options[:base], env)
|
24
|
+
if !vm
|
25
|
+
error_and_exit(:vm_base_not_found, :name => options[:base])
|
26
|
+
return # for tests
|
24
27
|
end
|
25
28
|
|
26
|
-
|
27
|
-
|
29
|
+
package_vm(vm)
|
30
|
+
end
|
31
|
+
|
32
|
+
def package_single(name)
|
33
|
+
if name.nil? && env.multivm?
|
34
|
+
error_and_exit(:package_multivm)
|
35
|
+
return
|
36
|
+
end
|
37
|
+
|
38
|
+
vm = if name.nil?
|
39
|
+
env.vms.values.first
|
40
|
+
else
|
41
|
+
env.vms[name.to_sym]
|
42
|
+
end
|
43
|
+
|
44
|
+
if vm.nil?
|
45
|
+
error_and_exit(:unknown_vm, :vm => name)
|
46
|
+
return
|
47
|
+
elsif !vm.created?
|
48
|
+
error_and_exit(:environment_not_created)
|
49
|
+
return
|
50
|
+
end
|
51
|
+
|
52
|
+
package_vm(vm)
|
53
|
+
end
|
54
|
+
|
55
|
+
def package_vm(vm)
|
56
|
+
if !vm.powered_off?
|
57
|
+
error_and_exit(:vm_power_off_to_package)
|
58
|
+
return # for tests
|
59
|
+
end
|
60
|
+
|
61
|
+
vm.package(options)
|
28
62
|
end
|
29
63
|
|
30
64
|
def options_spec(opts)
|
@@ -32,15 +66,21 @@ module Vagrant
|
|
32
66
|
|
33
67
|
# Defaults
|
34
68
|
options[:include] = []
|
69
|
+
options[:base] = nil
|
70
|
+
options[:output] = nil
|
35
71
|
|
36
|
-
opts.on("--base
|
72
|
+
opts.on("--base BASE", "Name or UUID of VM to create a base box from") do |v|
|
37
73
|
options[:base] = v
|
38
74
|
end
|
39
75
|
|
40
76
|
opts.on("--include x,y,z", Array, "List of files to include in the package") do |v|
|
41
77
|
options[:include] = v
|
42
78
|
end
|
79
|
+
|
80
|
+
opts.on("-o", "--output FILE", "File to save the package as.") do |v|
|
81
|
+
options[:output] = v
|
82
|
+
end
|
43
83
|
end
|
44
84
|
end
|
45
85
|
end
|
46
|
-
end
|
86
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Vagrant
|
2
|
+
class Commands
|
3
|
+
#run the provisioner on a running vm
|
4
|
+
class Provision < Base
|
5
|
+
Base.subcommand "provision", self
|
6
|
+
description "Run the provisioner"
|
7
|
+
|
8
|
+
def execute(args=[])
|
9
|
+
all_or_single(args, :provision)
|
10
|
+
end
|
11
|
+
|
12
|
+
def provision_single(name)
|
13
|
+
vm = env.vms[name.to_sym]
|
14
|
+
if vm.nil?
|
15
|
+
error_and_exit(:unknown_vm, :vm => name)
|
16
|
+
return # for tests
|
17
|
+
end
|
18
|
+
|
19
|
+
if vm.vm.running?
|
20
|
+
vm.provision
|
21
|
+
else
|
22
|
+
vm.env.logger.info "VM '#{name}' not running. Ignoring provision request."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def options_spec(opts)
|
27
|
+
opts.banner = "Usage: vagrant provision"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -10,8 +10,21 @@ module Vagrant
|
|
10
10
|
description "Reload the vagrant environment"
|
11
11
|
|
12
12
|
def execute(args=[])
|
13
|
-
|
14
|
-
|
13
|
+
all_or_single(args, :reload)
|
14
|
+
end
|
15
|
+
|
16
|
+
def reload_single(name)
|
17
|
+
vm = env.vms[name.to_sym]
|
18
|
+
if vm.nil?
|
19
|
+
error_and_exit(:unknown_vm, :vm => name)
|
20
|
+
return # for tests
|
21
|
+
end
|
22
|
+
|
23
|
+
if vm.created?
|
24
|
+
vm.reload
|
25
|
+
else
|
26
|
+
vm.env.logger.info "VM '#{name}' not created. Ignoring."
|
27
|
+
end
|
15
28
|
end
|
16
29
|
|
17
30
|
def options_spec(opts)
|
@@ -19,4 +32,4 @@ module Vagrant
|
|
19
32
|
end
|
20
33
|
end
|
21
34
|
end
|
22
|
-
end
|
35
|
+
end
|
@@ -10,8 +10,21 @@ module Vagrant
|
|
10
10
|
description "Resumes a suspend vagrant environment"
|
11
11
|
|
12
12
|
def execute(args=[])
|
13
|
-
|
14
|
-
|
13
|
+
all_or_single(args, :resume)
|
14
|
+
end
|
15
|
+
|
16
|
+
def resume_single(name)
|
17
|
+
vm = env.vms[name.to_sym]
|
18
|
+
if vm.nil?
|
19
|
+
error_and_exit(:unknown_vm, :vm => name)
|
20
|
+
return # for tests
|
21
|
+
end
|
22
|
+
|
23
|
+
if vm.created?
|
24
|
+
vm.resume
|
25
|
+
else
|
26
|
+
vm.env.logger.info "VM '#{name}' not created. Ignoring."
|
27
|
+
end
|
15
28
|
end
|
16
29
|
|
17
30
|
def options_spec(opts)
|
@@ -19,4 +32,4 @@ module Vagrant
|
|
19
32
|
end
|
20
33
|
end
|
21
34
|
end
|
22
|
-
end
|
35
|
+
end
|
data/lib/vagrant/commands/ssh.rb
CHANGED
@@ -10,8 +10,30 @@ module Vagrant
|
|
10
10
|
description "SSH into the currently running environment"
|
11
11
|
|
12
12
|
def execute(args=[])
|
13
|
-
|
14
|
-
|
13
|
+
args = parse_options(args)
|
14
|
+
ssh_connect(args[0])
|
15
|
+
end
|
16
|
+
|
17
|
+
def ssh_connect(name)
|
18
|
+
if name.nil? && env.multivm?
|
19
|
+
if env.primary_vm.nil?
|
20
|
+
error_and_exit(:ssh_multivm)
|
21
|
+
return # for tests
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
vm = name.nil? ? env.primary_vm : env.vms[name.to_sym]
|
26
|
+
if vm.nil?
|
27
|
+
error_and_exit(:unknown_vm, :vm => name)
|
28
|
+
return # for tests
|
29
|
+
end
|
30
|
+
|
31
|
+
if !vm.created?
|
32
|
+
error_and_exit(:environment_not_created)
|
33
|
+
return
|
34
|
+
else
|
35
|
+
vm.ssh.connect
|
36
|
+
end
|
15
37
|
end
|
16
38
|
|
17
39
|
def options_spec(opts)
|
@@ -19,4 +41,4 @@ module Vagrant
|
|
19
41
|
end
|
20
42
|
end
|
21
43
|
end
|
22
|
-
end
|
44
|
+
end
|