vagrantup 0.4.3.dev → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/config/default.rb +6 -6
  4. data/lib/vagrant.rb +6 -3
  5. data/lib/vagrant/action.rb +77 -0
  6. data/lib/vagrant/action/action_exception.rb +16 -0
  7. data/lib/vagrant/action/box/destroy.rb +19 -0
  8. data/lib/vagrant/action/box/download.rb +78 -0
  9. data/lib/vagrant/action/box/unpackage.rb +58 -0
  10. data/lib/vagrant/action/box/verify.rb +23 -0
  11. data/lib/vagrant/action/builder.rb +151 -0
  12. data/lib/vagrant/action/builtin.rb +114 -0
  13. data/lib/vagrant/action/env/error_halt.rb +16 -0
  14. data/lib/vagrant/action/env/set.rb +18 -0
  15. data/lib/vagrant/action/environment.rb +98 -0
  16. data/lib/vagrant/action/exception_catcher.rb +14 -0
  17. data/lib/vagrant/action/vm/boot.rb +54 -0
  18. data/lib/vagrant/action/vm/check_box.rb +27 -0
  19. data/lib/vagrant/action/vm/check_guest_additions.rb +32 -0
  20. data/lib/vagrant/action/vm/clean_machine_folder.rb +43 -0
  21. data/lib/vagrant/action/vm/clear_forwarded_ports.rb +39 -0
  22. data/lib/vagrant/action/vm/clear_nfs_exports.rb +20 -0
  23. data/lib/vagrant/action/vm/clear_shared_folders.rb +32 -0
  24. data/lib/vagrant/action/vm/customize.rb +21 -0
  25. data/lib/vagrant/action/vm/destroy.rb +20 -0
  26. data/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb +35 -0
  27. data/lib/vagrant/action/vm/disable_networks.rb +26 -0
  28. data/lib/vagrant/action/vm/export.rb +53 -0
  29. data/lib/vagrant/action/vm/forward_ports.rb +121 -0
  30. data/lib/vagrant/action/vm/forward_ports_helpers.rb +28 -0
  31. data/lib/vagrant/action/vm/halt.rb +34 -0
  32. data/lib/vagrant/action/vm/import.rb +33 -0
  33. data/lib/vagrant/action/vm/match_mac_address.rb +19 -0
  34. data/lib/vagrant/{actions → action}/vm/network.rb +47 -55
  35. data/lib/vagrant/action/vm/nfs.rb +161 -0
  36. data/lib/vagrant/action/vm/nfs_helpers.rb +11 -0
  37. data/lib/vagrant/action/vm/package.rb +99 -0
  38. data/lib/vagrant/action/vm/persist.rb +22 -0
  39. data/lib/vagrant/action/vm/provision.rb +50 -0
  40. data/lib/vagrant/action/vm/resume.rb +20 -0
  41. data/lib/vagrant/{actions/vm/shared_folders.rb → action/vm/share_folders.rb} +48 -45
  42. data/lib/vagrant/action/vm/suspend.rb +20 -0
  43. data/lib/vagrant/box.rb +3 -7
  44. data/lib/vagrant/commands/base.rb +1 -3
  45. data/lib/vagrant/commands/package.rb +4 -9
  46. data/lib/vagrant/commands/up.rb +0 -2
  47. data/lib/vagrant/config.rb +15 -1
  48. data/lib/vagrant/downloaders/file.rb +1 -1
  49. data/lib/vagrant/downloaders/http.rb +2 -1
  50. data/lib/vagrant/environment.rb +18 -14
  51. data/lib/vagrant/hosts/base.rb +77 -0
  52. data/lib/vagrant/hosts/bsd.rb +53 -0
  53. data/lib/vagrant/hosts/linux.rb +52 -0
  54. data/lib/vagrant/provisioners/base.rb +17 -9
  55. data/lib/vagrant/provisioners/chef.rb +1 -1
  56. data/lib/vagrant/provisioners/chef_server.rb +4 -8
  57. data/lib/vagrant/provisioners/chef_solo.rb +1 -2
  58. data/lib/vagrant/ssh.rb +12 -4
  59. data/lib/vagrant/systems/base.rb +4 -0
  60. data/lib/vagrant/systems/linux.rb +12 -1
  61. data/lib/vagrant/util.rb +16 -0
  62. data/lib/vagrant/util/busy.rb +59 -0
  63. data/lib/vagrant/util/plain_logger.rb +11 -0
  64. data/lib/vagrant/util/platform.rb +18 -0
  65. data/lib/vagrant/util/resource_logger.rb +128 -0
  66. data/lib/vagrant/version.rb +6 -0
  67. data/lib/vagrant/vm.rb +10 -12
  68. data/templates/chef_solo_solo.erb +2 -1
  69. data/templates/nfs/exports.erb +3 -0
  70. data/templates/nfs/exports_linux.erb +3 -0
  71. data/templates/strings.yml +23 -3
  72. metadata +121 -196
  73. data/.gitignore +0 -11
  74. data/Gemfile +0 -18
  75. data/Rakefile +0 -41
  76. data/VERSION +0 -1
  77. data/bin/.gitignore +0 -0
  78. data/lib/vagrant/actions/base.rb +0 -130
  79. data/lib/vagrant/actions/box/add.rb +0 -23
  80. data/lib/vagrant/actions/box/destroy.rb +0 -14
  81. data/lib/vagrant/actions/box/download.rb +0 -67
  82. data/lib/vagrant/actions/box/unpackage.rb +0 -42
  83. data/lib/vagrant/actions/box/verify.rb +0 -32
  84. data/lib/vagrant/actions/collection.rb +0 -36
  85. data/lib/vagrant/actions/runner.rb +0 -131
  86. data/lib/vagrant/actions/vm/boot.rb +0 -43
  87. data/lib/vagrant/actions/vm/customize.rb +0 -19
  88. data/lib/vagrant/actions/vm/destroy.rb +0 -24
  89. data/lib/vagrant/actions/vm/down.rb +0 -22
  90. data/lib/vagrant/actions/vm/export.rb +0 -45
  91. data/lib/vagrant/actions/vm/forward_ports.rb +0 -134
  92. data/lib/vagrant/actions/vm/halt.rb +0 -24
  93. data/lib/vagrant/actions/vm/import.rb +0 -23
  94. data/lib/vagrant/actions/vm/move_hard_drive.rb +0 -51
  95. data/lib/vagrant/actions/vm/package.rb +0 -94
  96. data/lib/vagrant/actions/vm/provision.rb +0 -49
  97. data/lib/vagrant/actions/vm/reload.rb +0 -17
  98. data/lib/vagrant/actions/vm/resume.rb +0 -16
  99. data/lib/vagrant/actions/vm/start.rb +0 -26
  100. data/lib/vagrant/actions/vm/suspend.rb +0 -16
  101. data/lib/vagrant/actions/vm/up.rb +0 -53
  102. data/lib/vagrant/busy.rb +0 -79
  103. data/lib/vagrant/resource_logger.rb +0 -126
  104. data/lib/vagrant/util/error_helper.rb +0 -13
  105. data/lib/vagrant/util/output_helper.rb +0 -9
  106. data/test/test_helper.rb +0 -149
  107. data/test/vagrant/actions/base_test.rb +0 -32
  108. data/test/vagrant/actions/box/add_test.rb +0 -36
  109. data/test/vagrant/actions/box/destroy_test.rb +0 -17
  110. data/test/vagrant/actions/box/download_test.rb +0 -137
  111. data/test/vagrant/actions/box/unpackage_test.rb +0 -99
  112. data/test/vagrant/actions/box/verify_test.rb +0 -44
  113. data/test/vagrant/actions/collection_test.rb +0 -113
  114. data/test/vagrant/actions/runner_test.rb +0 -268
  115. data/test/vagrant/actions/vm/boot_test.rb +0 -49
  116. data/test/vagrant/actions/vm/customize_test.rb +0 -21
  117. data/test/vagrant/actions/vm/destroy_test.rb +0 -37
  118. data/test/vagrant/actions/vm/down_test.rb +0 -39
  119. data/test/vagrant/actions/vm/export_test.rb +0 -88
  120. data/test/vagrant/actions/vm/forward_ports_test.rb +0 -253
  121. data/test/vagrant/actions/vm/halt_test.rb +0 -65
  122. data/test/vagrant/actions/vm/import_test.rb +0 -45
  123. data/test/vagrant/actions/vm/move_hard_drive_test.rb +0 -106
  124. data/test/vagrant/actions/vm/network_test.rb +0 -291
  125. data/test/vagrant/actions/vm/package_test.rb +0 -254
  126. data/test/vagrant/actions/vm/provision_test.rb +0 -99
  127. data/test/vagrant/actions/vm/reload_test.rb +0 -46
  128. data/test/vagrant/actions/vm/resume_test.rb +0 -26
  129. data/test/vagrant/actions/vm/shared_folders_test.rb +0 -211
  130. data/test/vagrant/actions/vm/start_test.rb +0 -73
  131. data/test/vagrant/actions/vm/suspend_test.rb +0 -26
  132. data/test/vagrant/actions/vm/up_test.rb +0 -96
  133. data/test/vagrant/active_list_test.rb +0 -173
  134. data/test/vagrant/box_test.rb +0 -154
  135. data/test/vagrant/busy_test.rb +0 -78
  136. data/test/vagrant/command_test.rb +0 -53
  137. data/test/vagrant/commands/base_test.rb +0 -139
  138. data/test/vagrant/commands/box/add_test.rb +0 -34
  139. data/test/vagrant/commands/box/list_test.rb +0 -32
  140. data/test/vagrant/commands/box/remove_test.rb +0 -41
  141. data/test/vagrant/commands/destroy_test.rb +0 -44
  142. data/test/vagrant/commands/halt_test.rb +0 -50
  143. data/test/vagrant/commands/init_test.rb +0 -55
  144. data/test/vagrant/commands/package_test.rb +0 -104
  145. data/test/vagrant/commands/provision_test.rb +0 -60
  146. data/test/vagrant/commands/reload_test.rb +0 -44
  147. data/test/vagrant/commands/resume_test.rb +0 -44
  148. data/test/vagrant/commands/ssh_config_test.rb +0 -77
  149. data/test/vagrant/commands/ssh_test.rb +0 -129
  150. data/test/vagrant/commands/status_test.rb +0 -40
  151. data/test/vagrant/commands/suspend_test.rb +0 -44
  152. data/test/vagrant/commands/up_test.rb +0 -47
  153. data/test/vagrant/config_test.rb +0 -287
  154. data/test/vagrant/downloaders/base_test.rb +0 -28
  155. data/test/vagrant/downloaders/file_test.rb +0 -33
  156. data/test/vagrant/downloaders/http_test.rb +0 -62
  157. data/test/vagrant/environment_test.rb +0 -770
  158. data/test/vagrant/provisioners/base_test.rb +0 -33
  159. data/test/vagrant/provisioners/chef_server_test.rb +0 -176
  160. data/test/vagrant/provisioners/chef_solo_test.rb +0 -183
  161. data/test/vagrant/provisioners/chef_test.rb +0 -175
  162. data/test/vagrant/resource_logger_test.rb +0 -145
  163. data/test/vagrant/ssh_session_test.rb +0 -46
  164. data/test/vagrant/ssh_test.rb +0 -296
  165. data/test/vagrant/systems/linux_test.rb +0 -179
  166. data/test/vagrant/util/error_helper_test.rb +0 -5
  167. data/test/vagrant/util/output_helper_test.rb +0 -5
  168. data/test/vagrant/util/plain_logger_test.rb +0 -17
  169. data/test/vagrant/util/platform_test.rb +0 -18
  170. data/test/vagrant/util/stacked_proc_runner_test.rb +0 -43
  171. data/test/vagrant/util/template_renderer_test.rb +0 -144
  172. data/test/vagrant/util/translator_test.rb +0 -61
  173. data/test/vagrant/util_test.rb +0 -27
  174. data/test/vagrant/vm_test.rb +0 -235
  175. data/vagrant.gemspec +0 -291
@@ -0,0 +1,20 @@
1
+ module Vagrant
2
+ class Action
3
+ module VM
4
+ class Resume
5
+ def initialize(app, env)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ if env["vm"].vm.saved?
11
+ env.logger.info "Resuming suspended VM..."
12
+ env["actions"].run(:start)
13
+ end
14
+
15
+ @app.call(env)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,13 +1,39 @@
1
1
  module Vagrant
2
- module Actions
2
+ class Action
3
3
  module VM
4
- class SharedFolders < Base
4
+ class ShareFolders
5
+ include ExceptionCatcher
6
+
7
+ def initialize(app, env)
8
+ @app = app
9
+ @env = env
10
+ end
11
+
12
+ def call(env)
13
+ @env = env
14
+
15
+ create_metadata
16
+
17
+ @app.call(env)
18
+
19
+ if !env.error?
20
+ catch_action_exception(env) do
21
+ # Only mount and setup shared folders in the absense of an
22
+ # error
23
+ mount_shared_folders
24
+ setup_unison
25
+ end
26
+ end
27
+ end
28
+
5
29
  # This method returns an actual list of VirtualBox shared
6
30
  # folders to create and their proper path.
7
31
  def shared_folders
8
- runner.env.config.vm.shared_folders.inject({}) do |acc, data|
32
+ @env.env.config.vm.shared_folders.inject({}) do |acc, data|
9
33
  key, value = data
10
34
 
35
+ next acc if value[:disabled]
36
+
11
37
  # This to prevent overwriting the actual shared folders data
12
38
  value = value.dup
13
39
 
@@ -15,7 +41,7 @@ module Vagrant
15
41
  # Syncing this folder. Change the guestpath to reflect
16
42
  # what we're actually mounting.
17
43
  value[:original] = value.dup
18
- value[:guestpath] = "#{value[:guestpath]}#{runner.env.config.unison.folder_suffix}"
44
+ value[:guestpath] = "#{value[:guestpath]}#{@env.env.config.unison.folder_suffix}"
19
45
  end
20
46
 
21
47
  acc[key] = value
@@ -33,23 +59,26 @@ module Vagrant
33
59
  end
34
60
  end
35
61
 
36
- def before_boot
37
- clear_shared_folders
38
- create_metadata
39
- end
62
+ def create_metadata
63
+ @env.logger.info "Creating shared folders metadata..."
40
64
 
41
- def after_boot
42
- mount_shared_folders
43
- setup_unison
65
+ shared_folders.each do |name, data|
66
+ folder = VirtualBox::SharedFolder.new
67
+ folder.name = name
68
+ folder.host_path = File.expand_path(data[:hostpath], @env.env.root_path)
69
+ @env["vm"].vm.shared_folders << folder
70
+ end
71
+
72
+ @env["vm"].vm.save
44
73
  end
45
74
 
46
75
  def mount_shared_folders
47
- logger.info "Mounting shared folders..."
76
+ @env.logger.info "Mounting shared folders..."
48
77
 
49
- @runner.ssh.execute do |ssh|
78
+ @env["vm"].ssh.execute do |ssh|
50
79
  shared_folders.each do |name, data|
51
- logger.info "-- #{name}: #{data[:guestpath]}"
52
- @runner.system.mount_shared_folder(ssh, name, data[:guestpath])
80
+ @env.logger.info "-- #{name}: #{data[:guestpath]}"
81
+ @env["vm"].system.mount_shared_folder(ssh, name, data[:guestpath])
53
82
  end
54
83
  end
55
84
  end
@@ -57,41 +86,15 @@ module Vagrant
57
86
  def setup_unison
58
87
  return if unison_folders.empty?
59
88
 
60
- runner.ssh.execute do |ssh|
61
- runner.system.prepare_unison(ssh)
89
+ @env["vm"].ssh.execute do |ssh|
90
+ @env["vm"].system.prepare_unison(ssh)
62
91
 
63
- logger.info "Creating unison crontab entries..."
92
+ @env.logger.info "Creating unison crontab entries..."
64
93
  unison_folders.each do |name, data|
65
- runner.system.create_unison(ssh, data)
94
+ @env["vm"].system.create_unison(ssh, data)
66
95
  end
67
96
  end
68
97
  end
69
-
70
- def clear_shared_folders
71
- if runner.vm.shared_folders.length > 0
72
- logger.info "Clearing previously set shared folders..."
73
-
74
- folders = @runner.vm.shared_folders.dup
75
- folders.each do |shared_folder|
76
- shared_folder.destroy
77
- end
78
-
79
- @runner.reload!
80
- end
81
- end
82
-
83
- def create_metadata
84
- logger.info "Creating shared folders metadata..."
85
-
86
- shared_folders.each do |name, data|
87
- folder = VirtualBox::SharedFolder.new
88
- folder.name = name
89
- folder.host_path = File.expand_path(data[:hostpath], runner.env.root_path)
90
- @runner.vm.shared_folders << folder
91
- end
92
-
93
- @runner.vm.save
94
- end
95
98
  end
96
99
  end
97
100
  end
@@ -0,0 +1,20 @@
1
+ module Vagrant
2
+ class Action
3
+ module VM
4
+ class Suspend
5
+ def initialize(app, env)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ if env["vm"].vm.running?
11
+ env.logger.info "Saving VM state and suspending execution..."
12
+ env["vm"].vm.save_state
13
+ end
14
+
15
+ @app.call(env)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -40,17 +40,13 @@ module Vagrant
40
40
  # box = Vagrant::Box.find("foo")
41
41
  # box.destroy
42
42
  #
43
- class Box < Actions::Runner
43
+ class Box
44
44
  # The name of the box.
45
45
  attr_accessor :name
46
46
 
47
47
  # The URI for a new box. This is not available for existing boxes.
48
48
  attr_accessor :uri
49
49
 
50
- # The temporary path to the downloaded or copied box. This should
51
- # only be used internally.
52
- attr_accessor :temp_path
53
-
54
50
  # The environment which this box belongs to. Although this could
55
51
  # actually be many environments, this points to the environment
56
52
  # of a specific instance.
@@ -133,12 +129,12 @@ module Vagrant
133
129
  # method requires that `name` and `uri` be set. The logic of this method
134
130
  # is kicked out to the {Actions::Box::Add add box} action.
135
131
  def add
136
- execute!(Actions::Box::Add)
132
+ env.actions.run(:box_add, { "box" => self })
137
133
  end
138
134
 
139
135
  # Beings the process of destroying this box.
140
136
  def destroy
141
- execute!(Actions::Box::Destroy)
137
+ env.actions.run(:box_remove, { "box" => self })
142
138
  end
143
139
 
144
140
  # Returns the directory to the location of this boxes content in the local
@@ -113,9 +113,7 @@ module Vagrant
113
113
 
114
114
  # Shows the version
115
115
  def puts_version
116
- File.open(File.join(PROJECT_ROOT, "VERSION"), "r") do |f|
117
- puts f.read
118
- end
116
+ puts VERSION
119
117
  end
120
118
 
121
119
  # Returns the `OptionParser` instance to be used with this subcommand,
@@ -53,11 +53,6 @@ module Vagrant
53
53
  end
54
54
 
55
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
56
  vm.package(options)
62
57
  end
63
58
 
@@ -65,20 +60,20 @@ module Vagrant
65
60
  opts.banner = "Usage: vagrant package [--base BASE] [--include FILES]"
66
61
 
67
62
  # Defaults
68
- options[:include] = []
69
63
  options[:base] = nil
70
- options[:output] = nil
64
+ options["package.output"] = nil
65
+ options["package.include"] = []
71
66
 
72
67
  opts.on("--base BASE", "Name or UUID of VM to create a base box from") do |v|
73
68
  options[:base] = v
74
69
  end
75
70
 
76
71
  opts.on("--include x,y,z", Array, "List of files to include in the package") do |v|
77
- options[:include] = v
72
+ options["package.include"] = v
78
73
  end
79
74
 
80
75
  opts.on("-o", "--output FILE", "File to save the package as.") do |v|
81
- options[:output] = v
76
+ options["package.output"] = v
82
77
  end
83
78
  end
84
79
  end
@@ -23,8 +23,6 @@ module Vagrant
23
23
  vm.env.logger.info "VM '#{name}' already created. Booting if its not already running..."
24
24
  vm.start
25
25
  else
26
- vm.env.require_box
27
-
28
26
  vm.env.logger.info "Creating VM '#{name}'"
29
27
  vm.up
30
28
  end
@@ -67,6 +67,7 @@ module Vagrant
67
67
  attr_accessor :max_tries
68
68
  attr_accessor :timeout
69
69
  attr_accessor :private_key_path
70
+ attr_accessor :forward_agent
70
71
 
71
72
  # The attribute(s) below do nothing. They are just kept here to
72
73
  # prevent syntax errors for backwards compat.
@@ -85,11 +86,17 @@ module Vagrant
85
86
  attr_accessor :log_file
86
87
  end
87
88
 
89
+ class NFSConfig < Base
90
+ attr_accessor :map_uid
91
+ attr_accessor :map_gid
92
+ end
93
+
88
94
  class VMConfig < Base
89
95
  include Util::StackedProcRunner
90
96
 
91
97
  attr_accessor :auto_port_range
92
98
  attr_accessor :box
99
+ attr_accessor :box_url
93
100
  attr_accessor :box_ovf
94
101
  attr_accessor :base_mac
95
102
  attr_accessor :boot_mode
@@ -185,13 +192,13 @@ module Vagrant
185
192
 
186
193
  class PackageConfig < Base
187
194
  attr_accessor :name
188
- attr_accessor :extension
189
195
  end
190
196
 
191
197
  class VagrantConfig < Base
192
198
  attr_accessor :dotfile_name
193
199
  attr_accessor :log_output
194
200
  attr_accessor :home
201
+ attr_accessor :host
195
202
 
196
203
  def home
197
204
  @home ? File.expand_path(@home) : nil
@@ -214,6 +221,7 @@ module Vagrant
214
221
 
215
222
  # Setup default configures
216
223
  configures :package, PackageConfig
224
+ configures :nfs, NFSConfig
217
225
  configures :ssh, SSHConfig
218
226
  configures :unison, UnisonConfig
219
227
  configures :vm, VMConfig
@@ -237,6 +245,12 @@ module Vagrant
237
245
  def loaded!
238
246
  @loaded = true
239
247
  end
248
+
249
+ # Deep clones the entire configuration tree using the marshalling
250
+ # trick. All subclasses must be able to marshal properly.
251
+ def deep_clone
252
+ Marshal.load(Marshal.dump(self))
253
+ end
240
254
  end
241
255
  end
242
256
  end
@@ -9,7 +9,7 @@ module Vagrant
9
9
 
10
10
  def prepare(source_url)
11
11
  if !::File.file?(source_url)
12
- raise Actions::ActionException.new(:downloader_file_doesnt_exist, :source_url => source_url)
12
+ return env.error!(:downloader_file_doesnt_exist, :source_url => source_url)
13
13
  end
14
14
  end
15
15
 
@@ -10,7 +10,6 @@ module Vagrant
10
10
  class HTTP < Base
11
11
  def self.match?(uri)
12
12
  # URI.parse barfs on '<drive letter>:\\files \on\ windows'
13
- # TODO temprorary
14
13
  extracted = URI.extract(uri).first
15
14
  extracted && extracted.include?(uri)
16
15
  end
@@ -48,6 +47,8 @@ module Vagrant
48
47
  end
49
48
 
50
49
  env.logger.clear_progress
50
+ rescue SocketError
51
+ env.error!(:box_download_http_socket_error, :box_url => source_url)
51
52
  end
52
53
  end
53
54
  end
@@ -15,12 +15,14 @@ module Vagrant
15
15
  attr_accessor :cwd
16
16
  attr_reader :root_path
17
17
  attr_reader :config
18
+ attr_reader :host
18
19
  attr_reader :box
19
20
  attr_accessor :vm
20
21
  attr_reader :vms
21
22
  attr_reader :active_list
22
23
  attr_reader :commands
23
24
  attr_reader :logger
25
+ attr_reader :actions
24
26
 
25
27
  #---------------------------------------------------------------
26
28
  # Class Methods
@@ -136,12 +138,14 @@ module Vagrant
136
138
  load_root_path!
137
139
  load_config!
138
140
  load_home_directory!
141
+ load_host!
139
142
  load_box!
140
143
  load_config!
141
144
  self.class.check_virtualbox!
142
145
  load_vm!
143
146
  load_active_list!
144
147
  load_commands!
148
+ load_actions!
145
149
  self
146
150
  end
147
151
 
@@ -216,7 +220,7 @@ module Vagrant
216
220
  # the logger will just send the log data to a black hole.
217
221
  def load_logger!
218
222
  resource = vm_name || "vagrant"
219
- @logger = ResourceLogger.new(resource, self)
223
+ @logger = Util::ResourceLogger.new(resource, self)
220
224
  end
221
225
 
222
226
  # Loads the home directory path and creates the necessary subdirectories
@@ -235,6 +239,11 @@ module Vagrant
235
239
  end
236
240
  end
237
241
 
242
+ # Loads the host class for this environment.
243
+ def load_host!
244
+ @host = Hosts::Base.load(self, config.vagrant.host)
245
+ end
246
+
238
247
  # Loads the specified box for this environment.
239
248
  def load_box!
240
249
  return unless root_path
@@ -301,6 +310,13 @@ module Vagrant
301
310
  @commands = Command.new(self)
302
311
  end
303
312
 
313
+ # Loads the instance of {Action} for this environment. This allows
314
+ # users of the instance to run action sequences in the context of
315
+ # this environment.
316
+ def load_actions!
317
+ @actions = Action.new(self)
318
+ end
319
+
304
320
  #---------------------------------------------------------------
305
321
  # Methods to manage VM
306
322
  #---------------------------------------------------------------
@@ -318,7 +334,7 @@ module Vagrant
318
334
  end
319
335
 
320
336
  if data.empty?
321
- File.delete(dotfile_path)
337
+ File.delete(dotfile_path) if File.exist?(dotfile_path)
322
338
  else
323
339
  File.open(dotfile_path, 'w+') do |f|
324
340
  f.write(data.to_json)
@@ -337,18 +353,6 @@ module Vagrant
337
353
  error_and_exit(:rootfile_not_found) if !root_path
338
354
  end
339
355
 
340
- def require_box
341
- require_root_path
342
-
343
- if !box
344
- if !config.vm.box
345
- error_and_exit(:box_not_specified)
346
- else
347
- error_and_exit(:box_specified_doesnt_exist, :box_name => config.vm.box)
348
- end
349
- end
350
- end
351
-
352
356
  def require_persisted_vm
353
357
  require_root_path
354
358