vagrantup 0.8.10 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (325) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +77 -1
  3. data/Gemfile +0 -14
  4. data/LICENSE +1 -1
  5. data/bin/vagrant +47 -20
  6. data/config/default.rb +6 -14
  7. data/lib/vagrant/action/box/destroy.rb +7 -3
  8. data/lib/vagrant/action/box/download.rb +8 -8
  9. data/lib/vagrant/action/box/package.rb +2 -2
  10. data/lib/vagrant/action/box/unpackage.rb +13 -7
  11. data/lib/vagrant/action/box/verify.rb +5 -5
  12. data/lib/vagrant/action/builder.rb +23 -19
  13. data/lib/vagrant/action/builtin.rb +117 -79
  14. data/lib/vagrant/action/env/set.rb +7 -4
  15. data/lib/vagrant/action/environment.rb +3 -41
  16. data/lib/vagrant/action/general/package.rb +14 -29
  17. data/lib/vagrant/action/general/validate.rb +2 -2
  18. data/lib/vagrant/action/runner.rb +53 -0
  19. data/lib/vagrant/action/vm/boot.rb +9 -9
  20. data/lib/vagrant/action/vm/check_accessible.rb +2 -2
  21. data/lib/vagrant/action/vm/check_box.rb +10 -12
  22. data/lib/vagrant/action/vm/check_guest_additions.rb +8 -8
  23. data/lib/vagrant/action/vm/check_port_collisions.rb +85 -0
  24. data/lib/vagrant/action/vm/clean_machine_folder.rb +4 -4
  25. data/lib/vagrant/action/vm/clear_forwarded_ports.rb +3 -11
  26. data/lib/vagrant/action/vm/clear_network_interfaces.rb +31 -0
  27. data/lib/vagrant/action/vm/clear_shared_folders.rb +2 -11
  28. data/lib/vagrant/action/vm/customize.rb +19 -9
  29. data/lib/vagrant/action/vm/destroy.rb +4 -4
  30. data/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb +2 -12
  31. data/lib/vagrant/action/vm/discard_state.rb +4 -4
  32. data/lib/vagrant/action/vm/export.rb +13 -8
  33. data/lib/vagrant/action/vm/forward_ports.rb +55 -102
  34. data/lib/vagrant/action/vm/halt.rb +9 -6
  35. data/lib/vagrant/action/vm/host_name.rb +4 -4
  36. data/lib/vagrant/action/vm/import.rb +19 -10
  37. data/lib/vagrant/action/vm/match_mac_address.rb +4 -9
  38. data/lib/vagrant/action/vm/network.rb +300 -94
  39. data/lib/vagrant/action/vm/nfs.rb +41 -26
  40. data/lib/vagrant/action/vm/package.rb +1 -1
  41. data/lib/vagrant/action/vm/package_vagrantfile.rb +5 -2
  42. data/lib/vagrant/action/vm/provision.rb +42 -13
  43. data/lib/vagrant/action/vm/provisioner_cleanup.rb +2 -2
  44. data/lib/vagrant/action/vm/{clear_nfs_exports.rb → prune_nfs_exports.rb} +7 -7
  45. data/lib/vagrant/action/vm/resume.rb +4 -4
  46. data/lib/vagrant/action/vm/setup_package_files.rb +54 -0
  47. data/lib/vagrant/action/vm/share_folders.rb +63 -39
  48. data/lib/vagrant/action/vm/suspend.rb +4 -4
  49. data/lib/vagrant/action/warden.rb +13 -6
  50. data/lib/vagrant/action.rb +45 -123
  51. data/lib/vagrant/box.rb +9 -55
  52. data/lib/vagrant/box_collection.rb +22 -17
  53. data/lib/vagrant/cli.rb +62 -47
  54. data/lib/vagrant/command/base.rb +135 -90
  55. data/lib/vagrant/command/box.rb +46 -21
  56. data/lib/vagrant/command/box_add.rb +33 -0
  57. data/lib/vagrant/command/box_list.rb +25 -0
  58. data/lib/vagrant/command/box_remove.rb +23 -0
  59. data/lib/vagrant/command/box_repackage.rb +23 -0
  60. data/lib/vagrant/command/destroy.rb +16 -5
  61. data/lib/vagrant/command/halt.rb +25 -7
  62. data/lib/vagrant/command/init.rb +30 -7
  63. data/lib/vagrant/command/package.rb +49 -18
  64. data/lib/vagrant/command/provision.rb +22 -9
  65. data/lib/vagrant/command/reload.rb +18 -5
  66. data/lib/vagrant/command/resume.rb +18 -5
  67. data/lib/vagrant/command/ssh.rb +69 -31
  68. data/lib/vagrant/command/ssh_config.rb +37 -22
  69. data/lib/vagrant/command/status.rb +22 -20
  70. data/lib/vagrant/command/suspend.rb +18 -5
  71. data/lib/vagrant/command/up.rb +41 -8
  72. data/lib/vagrant/command.rb +18 -20
  73. data/lib/vagrant/communication/base.rb +56 -0
  74. data/lib/vagrant/communication/ssh.rb +200 -0
  75. data/lib/vagrant/communication.rb +7 -0
  76. data/lib/vagrant/config/base.rb +18 -26
  77. data/lib/vagrant/config/container.rb +37 -0
  78. data/lib/vagrant/config/error_recorder.rb +1 -1
  79. data/lib/vagrant/config/loader.rb +125 -0
  80. data/lib/vagrant/config/nfs.rb +1 -3
  81. data/lib/vagrant/config/package.rb +1 -3
  82. data/lib/vagrant/config/ssh.rb +31 -16
  83. data/lib/vagrant/config/top.rb +36 -25
  84. data/lib/vagrant/config/vagrant.rb +2 -5
  85. data/lib/vagrant/config/vm/provisioner.rb +16 -20
  86. data/lib/vagrant/config/vm/sub_vm.rb +1 -1
  87. data/lib/vagrant/config/vm.rb +115 -56
  88. data/lib/vagrant/config.rb +29 -103
  89. data/lib/vagrant/data_store.rb +23 -15
  90. data/lib/vagrant/downloaders/base.rb +7 -5
  91. data/lib/vagrant/downloaders/file.rb +4 -4
  92. data/lib/vagrant/downloaders/http.rb +4 -5
  93. data/lib/vagrant/driver/virtualbox.rb +121 -0
  94. data/lib/vagrant/driver/virtualbox_4_0.rb +411 -0
  95. data/lib/vagrant/driver/virtualbox_4_1.rb +411 -0
  96. data/lib/vagrant/driver/virtualbox_base.rb +284 -0
  97. data/lib/vagrant/driver.rb +7 -0
  98. data/lib/vagrant/environment.rb +221 -240
  99. data/lib/vagrant/errors.rb +74 -25
  100. data/lib/vagrant/guest/arch.rb +48 -0
  101. data/lib/vagrant/{systems → guest}/base.rb +30 -18
  102. data/lib/vagrant/guest/debian.rb +61 -0
  103. data/lib/vagrant/{systems → guest}/freebsd.rb +11 -18
  104. data/lib/vagrant/guest/gentoo.rb +32 -0
  105. data/lib/vagrant/{systems → guest}/linux/config.rb +2 -4
  106. data/lib/vagrant/guest/linux/error.rb +9 -0
  107. data/lib/vagrant/guest/linux.rb +78 -0
  108. data/lib/vagrant/guest/redhat.rb +66 -0
  109. data/lib/vagrant/guest/solaris.rb +114 -0
  110. data/lib/vagrant/{systems → guest}/suse.rb +2 -2
  111. data/lib/vagrant/guest/ubuntu.rb +23 -0
  112. data/lib/vagrant/guest.rb +16 -0
  113. data/lib/vagrant/hosts/arch.rb +7 -3
  114. data/lib/vagrant/hosts/base.rb +36 -46
  115. data/lib/vagrant/hosts/bsd.rb +53 -16
  116. data/lib/vagrant/hosts/fedora.rb +14 -0
  117. data/lib/vagrant/hosts/freebsd.rb +6 -36
  118. data/lib/vagrant/hosts/linux.rb +45 -20
  119. data/lib/vagrant/hosts/windows.rb +16 -0
  120. data/lib/vagrant/hosts.rb +23 -6
  121. data/lib/vagrant/provisioners/base.rb +11 -34
  122. data/lib/vagrant/provisioners/chef.rb +30 -26
  123. data/lib/vagrant/provisioners/chef_client.rb +37 -23
  124. data/lib/vagrant/provisioners/chef_solo.rb +61 -16
  125. data/lib/vagrant/provisioners/puppet.rb +70 -38
  126. data/lib/vagrant/provisioners/puppet_server.rb +12 -13
  127. data/lib/vagrant/provisioners/shell.rb +24 -24
  128. data/lib/vagrant/provisioners.rb +10 -7
  129. data/lib/vagrant/registry.rb +49 -0
  130. data/lib/vagrant/ssh.rb +82 -153
  131. data/lib/vagrant/ui.rb +118 -50
  132. data/lib/vagrant/util/busy.rb +1 -1
  133. data/lib/vagrant/util/file_mode.rb +12 -0
  134. data/lib/vagrant/util/network_ip.rb +28 -0
  135. data/lib/vagrant/util/platform.rb +1 -0
  136. data/lib/vagrant/util/subprocess.rb +227 -0
  137. data/lib/vagrant/version.rb +1 -1
  138. data/lib/vagrant/vm.rb +111 -97
  139. data/lib/vagrant.rb +132 -5
  140. data/tasks/acceptance.rake +3 -3
  141. data/tasks/test.rake +7 -2
  142. data/templates/commands/init/Vagrantfile.erb +11 -4
  143. data/templates/{ssh_config.erb → commands/ssh_config/config.erb} +0 -0
  144. data/templates/guests/arch/network_dhcp.erb +7 -0
  145. data/templates/guests/arch/network_static.erb +7 -0
  146. data/templates/guests/debian/network_dhcp.erb +6 -0
  147. data/templates/guests/debian/network_static.erb +7 -0
  148. data/templates/guests/gentoo/network_dhcp.erb +4 -0
  149. data/templates/guests/gentoo/network_static.erb +4 -0
  150. data/templates/guests/redhat/network_dhcp.erb +6 -0
  151. data/templates/guests/redhat/network_static.erb +7 -0
  152. data/templates/locales/en.yml +241 -122
  153. data/templates/{chef_server_client.erb → provisioners/chef_client/client.erb} +0 -0
  154. data/templates/{chef_solo_solo.erb → provisioners/chef_solo/solo.erb} +0 -0
  155. data/test/acceptance/base.rb +10 -10
  156. data/test/acceptance/box_test.rb +28 -6
  157. data/test/acceptance/destroy_test.rb +1 -1
  158. data/test/acceptance/halt_test.rb +4 -4
  159. data/test/acceptance/init_test.rb +3 -3
  160. data/test/acceptance/networking/host_only_test.rb +37 -0
  161. data/test/acceptance/networking/port_forward_test.rb +125 -0
  162. data/test/acceptance/package_test.rb +46 -0
  163. data/test/acceptance/provisioning/basic_test.rb +61 -0
  164. data/test/acceptance/provisioning/chef_solo_test.rb +37 -0
  165. data/test/acceptance/provisioning/shell_test.rb +53 -0
  166. data/test/acceptance/resume_test.rb +1 -1
  167. data/test/acceptance/skeletons/chef_solo_basic/README.md +3 -0
  168. data/test/acceptance/skeletons/chef_solo_basic/cookbooks/basic/recipes/default.rb +5 -0
  169. data/test/acceptance/skeletons/chef_solo_json/README.md +3 -0
  170. data/test/acceptance/skeletons/chef_solo_json/cookbooks/basic/recipes/default.rb +6 -0
  171. data/test/acceptance/skeletons/provisioner_multi/README.md +3 -0
  172. data/test/acceptance/skeletons/provisioner_multi/cookbooks/basic/recipes/default.rb +5 -0
  173. data/test/acceptance/ssh_test.rb +7 -2
  174. data/test/acceptance/support/config.rb +1 -1
  175. data/test/acceptance/support/isolated_environment.rb +41 -150
  176. data/test/acceptance/support/matchers/match_output.rb +1 -1
  177. data/test/acceptance/support/matchers/succeed.rb +14 -0
  178. data/test/acceptance/support/network_tests.rb +29 -0
  179. data/test/acceptance/support/output.rb +9 -1
  180. data/test/acceptance/support/shared/base_context.rb +16 -9
  181. data/test/acceptance/support/shared/command_examples.rb +4 -4
  182. data/test/acceptance/suspend_test.rb +1 -1
  183. data/test/acceptance/up_basic_test.rb +26 -7
  184. data/test/acceptance/up_with_box_url.rb +1 -1
  185. data/test/acceptance/vagrant_test.rb +1 -1
  186. data/test/acceptance/version_test.rb +0 -5
  187. data/test/support/isolated_environment.rb +46 -0
  188. data/test/{acceptance/support → support}/tempdir.rb +0 -0
  189. data/test/unit/base.rb +21 -0
  190. data/test/unit/support/isolated_environment.rb +39 -0
  191. data/test/unit/support/shared/base_context.rb +30 -0
  192. data/test/unit/vagrant/action/builder_test.rb +126 -177
  193. data/test/unit/vagrant/action/environment_test.rb +10 -21
  194. data/test/unit/vagrant/action/runner_test.rb +65 -0
  195. data/test/unit/vagrant/action/warden_test.rb +64 -97
  196. data/test/unit/vagrant/box_collection_test.rb +44 -33
  197. data/test/unit/vagrant/box_test.rb +25 -65
  198. data/test/unit/vagrant/command/base_test.rb +141 -14
  199. data/test/unit/vagrant/config/base_test.rb +16 -43
  200. data/test/unit/vagrant/config/loader_test.rb +79 -0
  201. data/test/unit/vagrant/config/top_test.rb +69 -0
  202. data/test/unit/vagrant/config/vm_test.rb +62 -47
  203. data/test/unit/vagrant/config_test.rb +16 -151
  204. data/test/unit/vagrant/data_store_test.rb +43 -61
  205. data/test/unit/vagrant/downloaders/base_test.rb +12 -22
  206. data/test/unit/vagrant/downloaders/file_test.rb +58 -31
  207. data/test/unit/vagrant/downloaders/http_test.rb +12 -86
  208. data/test/unit/vagrant/environment_test.rb +107 -536
  209. data/test/unit/vagrant/hosts_test.rb +36 -0
  210. data/test/unit/vagrant/registry_test.rb +56 -0
  211. data/test/unit/vagrant/util/file_checksum_test.rb +23 -0
  212. data/test/unit/vagrant/util/hash_with_indifferent_access_test.rb +23 -24
  213. data/test/unit/vagrant/util/network_ip_test.rb +17 -0
  214. data/test/unit/vagrant/util/retryable_test.rb +90 -34
  215. data/test/unit/vagrant_test.rb +27 -0
  216. data/test/{unit → unit_legacy}/locales/en.yml +0 -0
  217. data/test/{unit → unit_legacy}/test_helper.rb +0 -0
  218. data/test/{unit → unit_legacy}/vagrant/action/box/destroy_test.rb +0 -0
  219. data/test/{unit → unit_legacy}/vagrant/action/box/download_test.rb +0 -0
  220. data/test/{unit → unit_legacy}/vagrant/action/box/package_test.rb +0 -0
  221. data/test/{unit → unit_legacy}/vagrant/action/box/unpackage_test.rb +0 -0
  222. data/test/{unit → unit_legacy}/vagrant/action/box/verify_test.rb +0 -0
  223. data/test/{unit → unit_legacy}/vagrant/action/env/set_test.rb +0 -0
  224. data/test/{unit → unit_legacy}/vagrant/action/general/package_test.rb +0 -0
  225. data/test/{unit → unit_legacy}/vagrant/action/general/validate_test.rb +0 -0
  226. data/test/{unit → unit_legacy}/vagrant/action/vm/boot_test.rb +0 -0
  227. data/test/{unit → unit_legacy}/vagrant/action/vm/check_accessible_test.rb +0 -0
  228. data/test/{unit → unit_legacy}/vagrant/action/vm/check_box_test.rb +0 -0
  229. data/test/{unit → unit_legacy}/vagrant/action/vm/check_guest_additions_test.rb +0 -0
  230. data/test/{unit → unit_legacy}/vagrant/action/vm/clean_machine_folder_test.rb +0 -0
  231. data/test/{unit → unit_legacy}/vagrant/action/vm/clear_forwarded_ports_test.rb +0 -0
  232. data/test/{unit → unit_legacy}/vagrant/action/vm/clear_nfs_exports_test.rb +0 -0
  233. data/test/{unit → unit_legacy}/vagrant/action/vm/clear_shared_folders_test.rb +0 -0
  234. data/test/{unit → unit_legacy}/vagrant/action/vm/customize_test.rb +0 -0
  235. data/test/{unit → unit_legacy}/vagrant/action/vm/destroy_test.rb +0 -0
  236. data/test/{unit → unit_legacy}/vagrant/action/vm/destroy_unused_network_interfaces_test.rb +0 -0
  237. data/test/{unit → unit_legacy}/vagrant/action/vm/discard_state_test.rb +0 -0
  238. data/test/{unit → unit_legacy}/vagrant/action/vm/export_test.rb +0 -0
  239. data/test/{unit → unit_legacy}/vagrant/action/vm/forward_ports_helpers_test.rb +0 -0
  240. data/test/{unit → unit_legacy}/vagrant/action/vm/forward_ports_test.rb +0 -0
  241. data/test/{unit → unit_legacy}/vagrant/action/vm/halt_test.rb +0 -0
  242. data/test/{unit → unit_legacy}/vagrant/action/vm/host_name_test.rb +0 -0
  243. data/test/{unit → unit_legacy}/vagrant/action/vm/import_test.rb +0 -0
  244. data/test/{unit → unit_legacy}/vagrant/action/vm/match_mac_address_test.rb +0 -0
  245. data/test/{unit → unit_legacy}/vagrant/action/vm/modify_test.rb +0 -0
  246. data/test/{unit → unit_legacy}/vagrant/action/vm/network_test.rb +0 -0
  247. data/test/{unit → unit_legacy}/vagrant/action/vm/nfs_helpers_test.rb +0 -0
  248. data/test/{unit → unit_legacy}/vagrant/action/vm/nfs_test.rb +0 -0
  249. data/test/{unit → unit_legacy}/vagrant/action/vm/package_test.rb +0 -0
  250. data/test/{unit → unit_legacy}/vagrant/action/vm/package_vagrantfile_test.rb +0 -0
  251. data/test/{unit → unit_legacy}/vagrant/action/vm/provision_test.rb +0 -0
  252. data/test/{unit → unit_legacy}/vagrant/action/vm/provisioner_cleanup_test.rb +0 -0
  253. data/test/{unit → unit_legacy}/vagrant/action/vm/resume_test.rb +0 -0
  254. data/test/{unit → unit_legacy}/vagrant/action/vm/share_folders_test.rb +0 -0
  255. data/test/{unit → unit_legacy}/vagrant/action/vm/suspend_test.rb +0 -0
  256. data/test/{unit → unit_legacy}/vagrant/action_test.rb +0 -0
  257. data/test/unit_legacy/vagrant/box_collection_test.rb +45 -0
  258. data/test/unit_legacy/vagrant/box_test.rb +74 -0
  259. data/test/{unit → unit_legacy}/vagrant/cli_test.rb +0 -0
  260. data/test/unit_legacy/vagrant/command/base_test.rb +23 -0
  261. data/test/{unit → unit_legacy}/vagrant/command/group_base_test.rb +0 -0
  262. data/test/{unit → unit_legacy}/vagrant/command/helpers_test.rb +0 -0
  263. data/test/{unit → unit_legacy}/vagrant/command/init_test.rb +0 -0
  264. data/test/{unit → unit_legacy}/vagrant/command/package_test.rb +0 -0
  265. data/test/unit_legacy/vagrant/config/base_test.rb +52 -0
  266. data/test/{unit → unit_legacy}/vagrant/config/error_recorder_test.rb +0 -0
  267. data/test/{unit → unit_legacy}/vagrant/config/ssh_test.rb +0 -0
  268. data/test/{unit → unit_legacy}/vagrant/config/vagrant_test.rb +0 -0
  269. data/test/{unit → unit_legacy}/vagrant/config/vm/provisioner_test.rb +0 -0
  270. data/test/unit_legacy/vagrant/config/vm_test.rb +47 -0
  271. data/test/unit_legacy/vagrant/config_test.rb +148 -0
  272. data/test/unit_legacy/vagrant/downloaders/http_test.rb +93 -0
  273. data/test/unit_legacy/vagrant/environment_test.rb +539 -0
  274. data/test/{unit → unit_legacy}/vagrant/errors_test.rb +0 -0
  275. data/test/{unit → unit_legacy}/vagrant/hosts/base_test.rb +0 -0
  276. data/test/{unit → unit_legacy}/vagrant/hosts/bsd_test.rb +0 -0
  277. data/test/{unit → unit_legacy}/vagrant/hosts/linux_test.rb +0 -0
  278. data/test/{unit → unit_legacy}/vagrant/plugin_test.rb +0 -0
  279. data/test/{unit → unit_legacy}/vagrant/provisioners/base_test.rb +0 -0
  280. data/test/{unit → unit_legacy}/vagrant/provisioners/chef_client_test.rb +0 -0
  281. data/test/{unit → unit_legacy}/vagrant/provisioners/chef_solo_test.rb +0 -0
  282. data/test/{unit → unit_legacy}/vagrant/provisioners/chef_test.rb +0 -0
  283. data/test/{unit → unit_legacy}/vagrant/provisioners/puppet_server_test.rb +0 -0
  284. data/test/{unit → unit_legacy}/vagrant/provisioners/puppet_test.rb +0 -0
  285. data/test/{unit → unit_legacy}/vagrant/provisioners/shell_test.rb +0 -0
  286. data/test/{unit → unit_legacy}/vagrant/ssh/session_test.rb +0 -0
  287. data/test/{unit → unit_legacy}/vagrant/ssh_test.rb +0 -0
  288. data/test/{unit → unit_legacy}/vagrant/systems/base_test.rb +0 -0
  289. data/test/{unit → unit_legacy}/vagrant/systems/linux_test.rb +0 -0
  290. data/test/{unit → unit_legacy}/vagrant/util/busy_test.rb +0 -0
  291. data/test/{unit → unit_legacy}/vagrant/util/counter_test.rb +0 -0
  292. data/test/{unit → unit_legacy}/vagrant/util/platform_test.rb +0 -0
  293. data/test/{unit → unit_legacy}/vagrant/util/stacked_proc_runner_test.rb +0 -0
  294. data/test/{unit → unit_legacy}/vagrant/util/template_renderer_test.rb +0 -0
  295. data/test/{unit → unit_legacy}/vagrant/vm_test.rb +0 -0
  296. data/vagrant.gemspec +7 -9
  297. metadata +183 -179
  298. data/keys/vagrant.ppk +0 -26
  299. data/lib/vagrant/action/box.rb +0 -11
  300. data/lib/vagrant/action/env.rb +0 -7
  301. data/lib/vagrant/action/general.rb +0 -8
  302. data/lib/vagrant/action/vm/forward_ports_helpers.rb +0 -28
  303. data/lib/vagrant/action/vm/modify.rb +0 -37
  304. data/lib/vagrant/action/vm/nfs_helpers.rb +0 -11
  305. data/lib/vagrant/action/vm.rb +0 -34
  306. data/lib/vagrant/command/group_base.rb +0 -107
  307. data/lib/vagrant/command/helpers.rb +0 -33
  308. data/lib/vagrant/command/named_base.rb +0 -14
  309. data/lib/vagrant/command/upgrade_to_060.rb +0 -45
  310. data/lib/vagrant/command/version.rb +0 -13
  311. data/lib/vagrant/ssh/session.rb +0 -136
  312. data/lib/vagrant/systems/arch.rb +0 -34
  313. data/lib/vagrant/systems/debian.rb +0 -36
  314. data/lib/vagrant/systems/gentoo.rb +0 -27
  315. data/lib/vagrant/systems/linux/error.rb +0 -9
  316. data/lib/vagrant/systems/linux.rb +0 -82
  317. data/lib/vagrant/systems/redhat.rb +0 -48
  318. data/lib/vagrant/systems/solaris.rb +0 -113
  319. data/lib/vagrant/systems/ubuntu.rb +0 -17
  320. data/lib/vagrant/systems.rb +0 -13
  321. data/templates/network_entry_arch.erb +0 -9
  322. data/templates/network_entry_debian.erb +0 -8
  323. data/templates/network_entry_gentoo.erb +0 -5
  324. data/templates/network_entry_redhat.erb +0 -9
  325. data/test/unit/vagrant/ui_test.rb +0 -29
@@ -13,17 +13,39 @@ describe "vagrant box" do
13
13
 
14
14
  # Add the box, which we expect to succeed
15
15
  result = execute("vagrant", "box", "add", "foo", box_path("default"))
16
- result.should be_success
16
+ result.should succeed
17
17
 
18
18
  # Verify that the box now shows up in the list of available boxes
19
19
  result = execute("vagrant", "box", "list")
20
20
  result.stdout.should match_output(:box_installed, "foo")
21
21
  end
22
22
 
23
+ it "errors if attempting to add a box with the same name" do
24
+ require_box("default")
25
+
26
+ # Add the box, which we expect to succeed
27
+ assert_execute("vagrant", "box", "add", "foo", box_path("default"))
28
+
29
+ # Adding it again should not succeed
30
+ result = execute("vagrant", "box", "add", "foo", box_path("default"))
31
+ result.should_not succeed
32
+ result.stderr.should match_output(:box_already_exists, "foo")
33
+ end
34
+
35
+ it "overwrites a box when adding with `--force`" do
36
+ require_box("default")
37
+
38
+ # Add the box, which we expect to succeed
39
+ assert_execute("vagrant", "box", "add", "foo", box_path("default"))
40
+
41
+ # Adding it again should not succeed
42
+ assert_execute("vagrant", "box", "add", "foo", box_path("default"), "--force")
43
+ end
44
+
23
45
  it "gives an error if the file doesn't exist" do
24
46
  result = execute("vagrant", "box", "add", "foo", "/tmp/nope/nope/nope/nonono.box")
25
- result.should_not be_success
26
- result.stdout.should match_output(:box_path_doesnt_exist)
47
+ result.should_not succeed
48
+ result.stderr.should match_output(:box_path_doesnt_exist)
27
49
  end
28
50
 
29
51
  it "gives an error if the file is not a valid box" do
@@ -33,8 +55,8 @@ describe "vagrant box" do
33
55
  end
34
56
 
35
57
  result = execute("vagrant", "box", "add", "foo", invalid.to_s)
36
- result.should_not be_success
37
- result.stdout.should match_output(:box_invalid)
58
+ result.should_not succeed
59
+ result.stderr.should match_output(:box_invalid)
38
60
  end
39
61
 
40
62
  it "can add a box from an HTTP server" do
@@ -49,7 +71,7 @@ describe "vagrant box" do
49
71
  execute("vagrant", "box", "add", "foo", box_path("default"))
50
72
  execute("vagrant", "box", "remove", "foo")
51
73
  result = execute("vagrant", "box", "list")
52
- result.should be_success
74
+ result.should succeed
53
75
  result.stdout.should match_output(:no_boxes)
54
76
  end
55
77
 
@@ -1,5 +1,5 @@
1
1
  require File.expand_path("../base", __FILE__)
2
- require "support/shared/command_examples"
2
+ require "acceptance/support/shared/command_examples"
3
3
 
4
4
  describe "vagrant destroy" do
5
5
  include_context "acceptance"
@@ -1,5 +1,5 @@
1
1
  require File.expand_path("../base", __FILE__)
2
- require "support/shared/command_examples"
2
+ require "acceptance/support/shared/command_examples"
3
3
 
4
4
  describe "vagrant halt" do
5
5
  include_context "acceptance"
@@ -28,7 +28,7 @@ describe "vagrant halt" do
28
28
 
29
29
  # Assert that the VM is no longer running
30
30
  result = assert_execute("vagrant", "status")
31
- result.stdout.should match_output(:status, "default", "powered off")
31
+ result.stdout.should match_output(:status, "default", "poweroff")
32
32
  end
33
33
 
34
34
  it "is able to force halt a running virtual machine" do
@@ -44,7 +44,7 @@ describe "vagrant halt" do
44
44
 
45
45
  # Assert that the VM is no longer running
46
46
  result = assert_execute("vagrant", "status")
47
- result.stdout.should match_output(:status, "default", "powered off")
47
+ result.stdout.should match_output(:status, "default", "poweroff")
48
48
  end
49
49
 
50
50
  it "is able to come back up after the machine has been halted" do
@@ -57,7 +57,7 @@ describe "vagrant halt" do
57
57
 
58
58
  # Assert that the VM is no longer running
59
59
  result = assert_execute("vagrant", "status")
60
- result.stdout.should match_output(:status, "default", "powered off")
60
+ result.stdout.should match_output(:status, "default", "poweroff")
61
61
 
62
62
  assert_execute("vagrant", "up")
63
63
 
@@ -8,7 +8,7 @@ describe "vagrant init" do
8
8
  vagrantfile.exist?.should_not be, "Vagrantfile shouldn't exist initially"
9
9
 
10
10
  result = execute("vagrant", "init")
11
- result.should be_success
11
+ result.should succeed
12
12
  vagrantfile.exist?.should be, "Vagrantfile should exist"
13
13
  end
14
14
 
@@ -16,7 +16,7 @@ describe "vagrant init" do
16
16
  vagrantfile = environment.workdir.join("Vagrantfile")
17
17
 
18
18
  result = execute("vagrant", "init", "foo")
19
- result.should be_success
19
+ result.should succeed
20
20
  vagrantfile.read.should match(/config.vm.box = "foo"$/)
21
21
  end
22
22
 
@@ -24,7 +24,7 @@ describe "vagrant init" do
24
24
  vagrantfile = environment.workdir.join("Vagrantfile")
25
25
 
26
26
  result = execute("vagrant", "init", "foo", "bar")
27
- result.should be_success
27
+ result.should succeed
28
28
 
29
29
  contents = vagrantfile.read
30
30
  contents.should match(/config.vm.box = "foo"$/)
@@ -0,0 +1,37 @@
1
+ require File.expand_path("../../base", __FILE__)
2
+
3
+ require "net/http"
4
+ require "uri"
5
+
6
+ require "acceptance/support/network_tests"
7
+ require "acceptance/support/shared/command_examples"
8
+ require "support/tempdir"
9
+
10
+ describe "vagrant host only networking" do
11
+ include Acceptance::NetworkTests
12
+
13
+ include_context "acceptance"
14
+
15
+ def initialize_environment(env=nil)
16
+ require_box("default")
17
+
18
+ env ||= environment
19
+ env.execute("vagrant", "box", "add", "base", box_path("default")).should succeed
20
+ end
21
+
22
+ it "creates a network with a static IP" do
23
+ initialize_environment
24
+
25
+ environment.workdir.join("Vagrantfile").open("w+") do |f|
26
+ f.puts(<<VFILE)
27
+ Vagrant::Config.run do |config|
28
+ config.vm.box = "base"
29
+ config.vm.network :hostonly, "33.33.33.10"
30
+ end
31
+ VFILE
32
+ end
33
+
34
+ assert_execute("vagrant", "up")
35
+ assert_host_to_vm_network("http://33.33.33.10:8000/", 8000)
36
+ end
37
+ end
@@ -0,0 +1,125 @@
1
+ require File.expand_path("../../base", __FILE__)
2
+
3
+ require "net/http"
4
+ require "uri"
5
+
6
+ require "acceptance/support/network_tests"
7
+ require "acceptance/support/shared/command_examples"
8
+ require "support/tempdir"
9
+
10
+ describe "vagrant port forwarding" do
11
+ include Acceptance::NetworkTests
12
+
13
+ include_context "acceptance"
14
+
15
+ def initialize_environment(env=nil)
16
+ require_box("default")
17
+
18
+ env ||= environment
19
+ env.execute("vagrant", "box", "add", "base", box_path("default")).should succeed
20
+ end
21
+
22
+ it "forwards ports properly" do
23
+ initialize_environment
24
+
25
+ guest_port = 3000
26
+ host_port = 5000
27
+
28
+ environment.workdir.join("Vagrantfile").open("w+") do |f|
29
+ f.puts(<<VFILE)
30
+ Vagrant::Config.run do |config|
31
+ config.vm.box = "base"
32
+ config.vm.forward_port #{guest_port}, #{host_port}
33
+ end
34
+ VFILE
35
+ end
36
+
37
+ assert_execute("vagrant", "up")
38
+ assert_host_to_vm_network("http://localhost:#{host_port}/", guest_port)
39
+ end
40
+
41
+ it "properly overrides port forwarding from the same port" do
42
+ initialize_environment
43
+
44
+ guest_port = 3000
45
+ host_port = 5000
46
+
47
+ environment.workdir.join("Vagrantfile").open("w+") do |f|
48
+ f.puts(<<VFILE)
49
+ Vagrant::Config.run do |config|
50
+ config.vm.box = "base"
51
+ config.vm.forward_port #{guest_port}, #{host_port - 1}
52
+ config.vm.forward_port #{guest_port}, #{host_port}
53
+ end
54
+ VFILE
55
+ end
56
+
57
+ assert_execute("vagrant", "up")
58
+ assert_host_to_vm_network("http://localhost:#{host_port}/", guest_port)
59
+ end
60
+
61
+ it "detects and corrects port collisions" do
62
+ # The two environments need to share a VBOX_USER_HOME so that the
63
+ # VM's go into the same place.
64
+ env_vars = { "VBOX_USER_HOME" => Tempdir.new("vagrant").to_s }
65
+ environment = new_environment(env_vars)
66
+ environment2 = new_environment(env_vars)
67
+
68
+ # For this test we create two isolated environments and `vagrant up`
69
+ # in each. SSH would collide, so this verifies that it won't!
70
+ begin
71
+ initialize_environment(environment)
72
+ initialize_environment(environment2)
73
+
74
+ # Build both environments up.
75
+ environment.execute("vagrant", "init").should succeed
76
+ environment.execute("vagrant", "up").should succeed
77
+ environment2.execute("vagrant", "init").should succeed
78
+ environment2.execute("vagrant", "up").should succeed
79
+
80
+ # Touch files in both environments
81
+ environment.execute("vagrant", "ssh", "-c", "touch /vagrant/foo").should succeed
82
+ environment2.execute("vagrant", "ssh", "-c", "touch /vagrant/bar").should succeed
83
+
84
+ # Verify that the files exist in each folder, properly
85
+ environment.workdir.join("foo").exist?.should be
86
+ environment2.workdir.join("bar").exist?.should be
87
+ ensure
88
+ environment.close
89
+ environment2.close
90
+ end
91
+ end
92
+
93
+ it "refuses to resume if there is a port collision" do
94
+ # The two environments need to share a VBOX_USER_HOME so that the
95
+ # VM's go into the same place.
96
+ env_vars = { "VBOX_USER_HOME" => Tempdir.new("vagrant").path }
97
+ environment = new_environment(env_vars)
98
+ environment2 = new_environment(env_vars)
99
+
100
+ # For this test we `vagrant up` one environment, suspend it,
101
+ # `vagrant up` another environment, and then come back to the first
102
+ # and try to resume. SSH would collide so it should error.
103
+ begin
104
+ # Bring up the first environment and suspend it
105
+ initialize_environment(environment)
106
+ environment.execute("vagrant", "init").should succeed
107
+ environment.execute("vagrant", "up").should succeed
108
+ environment.execute("vagrant", "suspend").should succeed
109
+
110
+ # Bring up the second environment
111
+ initialize_environment(environment2)
112
+ environment2.execute("vagrant", "init").should succeed
113
+ environment2.execute("vagrant", "up").should succeed
114
+
115
+ # Attempt to bring up the first environment again, but it should
116
+ # result in an error.
117
+ result = environment.execute("vagrant", "up")
118
+ result.should_not succeed
119
+ result.stderr.should match_output(:resume_port_collision)
120
+ ensure
121
+ environment.close
122
+ environment2.close
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,46 @@
1
+ require File.expand_path("../base", __FILE__)
2
+ require "acceptance/support/shared/command_examples"
3
+
4
+ describe "vagrant package" do
5
+ include_context "acceptance"
6
+
7
+ # This creates an initial environment that is ready for a "vagrant up"
8
+ def initialize_valid_environment
9
+ require_box("default")
10
+
11
+ assert_execute("vagrant", "box", "add", "base", box_path("default"))
12
+ assert_execute("vagrant", "init")
13
+ end
14
+
15
+ it "can package a running virtual machine" do
16
+ initialize_valid_environment
17
+
18
+ assert_execute("vagrant", "up")
19
+ assert_execute("vagrant", "package")
20
+ environment.workdir.join("package.box").should be_file
21
+ end
22
+
23
+ it "can package a `base` VM directly from VirtualBox" do
24
+ initialize_valid_environment
25
+
26
+ # Use a custom Vagrantfile that sets the VM name to `foo`
27
+ environment.workdir.join("Vagrantfile").open("w+") do |f|
28
+ f.write(<<-vf)
29
+ Vagrant::Config.run do |config|
30
+ config.vm.box = "base"
31
+ config.vm.customize ["modifyvm", :id, "--name", "foo"]
32
+ end
33
+ vf
34
+ end
35
+
36
+ # Bring up the VM
37
+ assert_execute("vagrant", "up")
38
+
39
+ # Remove the Vagrantfile so it doesn't use that
40
+ environment.workdir.join("Vagrantfile").unlink
41
+
42
+ # Now package the base VM
43
+ assert_execute("vagrant", "package", "--base", "foo")
44
+ environment.workdir.join("package.box").should be_file
45
+ end
46
+ end
@@ -0,0 +1,61 @@
1
+ require File.expand_path("../../base", __FILE__)
2
+
3
+ describe "vagrant provisioning basics" do
4
+ include_context "acceptance"
5
+
6
+ it "doesn't provision with `--no-provision` set" do
7
+ require_box("default")
8
+
9
+ assert_execute("vagrant", "box", "add", "base", box_path("default"))
10
+
11
+ environment.workdir.join("Vagrantfile").open("w+") do |f|
12
+ f.write(<<-vf)
13
+ Vagrant::Config.run do |config|
14
+ config.vm.box = "base"
15
+ config.vm.provision :shell, :inline => "echo success > /vagrant/results"
16
+ end
17
+ vf
18
+ end
19
+
20
+ # Bring the VM up without enabling provisioning
21
+ assert_execute("vagrant", "up", "--no-provision")
22
+
23
+ # Verify the file that the script creates does NOT exist
24
+ result_file = environment.workdir.join("results")
25
+ result_file.exist?.should_not be
26
+ end
27
+
28
+ it "can provision with multiple provisioners" do
29
+ # Skeleton for multiple provisioners
30
+ environment.skeleton!("provisioner_multi")
31
+
32
+ # Setup the basic environment
33
+ require_box("default")
34
+ assert_execute("vagrant", "box", "add", "base", box_path("default"))
35
+
36
+ # Bring up the VM
37
+ assert_execute("vagrant", "up")
38
+
39
+ # Verify the file the shell provisioner made is there, but not the
40
+ # Chef one.
41
+ environment.workdir.join("shell").exist?.should be
42
+ environment.workdir.join("chef_solo").exist?.should be
43
+ end
44
+
45
+ it "only uses the provisioners specified with `--provision-with`" do
46
+ # Skeleton for multiple provisioners
47
+ environment.skeleton!("provisioner_multi")
48
+
49
+ # Setup the basic environment
50
+ require_box("default")
51
+ assert_execute("vagrant", "box", "add", "base", box_path("default"))
52
+
53
+ # Bring up the VM, only using the shell provisioner
54
+ assert_execute("vagrant", "up", "--provision-with", "shell")
55
+
56
+ # Verify the file the shell provisioner made is there, but not the
57
+ # Chef one.
58
+ environment.workdir.join("shell").exist?.should be
59
+ environment.workdir.join("chef_solo").exist?.should_not be
60
+ end
61
+ end
@@ -0,0 +1,37 @@
1
+ require File.expand_path("../../base", __FILE__)
2
+
3
+ describe "vagrant provisioning with chef solo" do
4
+ include_context "acceptance"
5
+
6
+ it "runs basic cookbooks" do
7
+ # Create the chef solo basic skeleton
8
+ environment.skeleton!("chef_solo_basic")
9
+
10
+ # Setup the basic environment
11
+ require_box("default")
12
+ assert_execute("vagrant", "box", "add", "base", box_path("default"))
13
+
14
+ # Bring up the VM
15
+ assert_execute("vagrant", "up")
16
+
17
+ # Check for the file it should have created
18
+ results = assert_execute("vagrant", "ssh", "-c", "cat /tmp/chef_solo_basic")
19
+ results.stdout.should == "success"
20
+ end
21
+
22
+ it "merges JSON into the attributes" do
23
+ # Copy the skeleton
24
+ environment.skeleton!("chef_solo_json")
25
+
26
+ # Setup the basic environment
27
+ require_box("default")
28
+ assert_execute("vagrant", "box", "add", "base", box_path("default"))
29
+
30
+ # Bring up the VM
31
+ assert_execute("vagrant", "up")
32
+
33
+ # Check for the file it should have created
34
+ results = assert_execute("vagrant", "ssh", "-c", "cat /tmp/chef_solo_basic")
35
+ results.stdout.should == "json_data"
36
+ end
37
+ end
@@ -0,0 +1,53 @@
1
+ require File.expand_path("../../base", __FILE__)
2
+
3
+ describe "vagrant provisioning with shell" do
4
+ include_context "acceptance"
5
+
6
+ it "runs a script on boot" do
7
+ require_box("default")
8
+
9
+ assert_execute("vagrant", "box", "add", "base", box_path("default"))
10
+
11
+ environment.workdir.join("Vagrantfile").open("w+") do |f|
12
+ f.write(<<-vf)
13
+ Vagrant::Config.run do |config|
14
+ config.vm.box = "base"
15
+ config.vm.provision :shell, :path => "script.sh"
16
+ end
17
+ vf
18
+ end
19
+
20
+ environment.workdir.join("script.sh").open("w+") do |f|
21
+ f.write(<<-vf)
22
+ echo success > /vagrant/results
23
+ vf
24
+ end
25
+
26
+ assert_execute("vagrant", "up")
27
+
28
+ result_file = environment.workdir.join("results")
29
+ result_file.exist?.should be
30
+ result_file.read.should == "success\n"
31
+ end
32
+
33
+ it "runs an inline script" do
34
+ require_box("default")
35
+
36
+ assert_execute("vagrant", "box", "add", "base", box_path("default"))
37
+
38
+ environment.workdir.join("Vagrantfile").open("w+") do |f|
39
+ f.write(<<-vf)
40
+ Vagrant::Config.run do |config|
41
+ config.vm.box = "base"
42
+ config.vm.provision :shell, :inline => "echo success > /vagrant/results"
43
+ end
44
+ vf
45
+ end
46
+
47
+ assert_execute("vagrant", "up")
48
+
49
+ result_file = environment.workdir.join("results")
50
+ result_file.exist?.should be
51
+ result_file.read.should == "success\n"
52
+ end
53
+ end
@@ -1,5 +1,5 @@
1
1
  require File.expand_path("../base", __FILE__)
2
- require "support/shared/command_examples"
2
+ require "acceptance/support/shared/command_examples"
3
3
 
4
4
  describe "vagrant resume" do
5
5
  include_context "acceptance"
@@ -0,0 +1,3 @@
1
+ # Chef Solo Basic Skeleton
2
+
3
+ This is a skeleton that contains a basic chef solo setup.
@@ -0,0 +1,5 @@
1
+ # Just create a file
2
+ file "/tmp/chef_solo_basic" do
3
+ mode 0644
4
+ content "success"
5
+ end
@@ -0,0 +1,3 @@
1
+ # Chef Solo Basic Skeleton
2
+
3
+ This is a skeleton that contains a basic chef solo setup.
@@ -0,0 +1,6 @@
1
+ # Create a file where the contents is the data we set with
2
+ # the Vagrantfile.
3
+ file "/tmp/chef_solo_basic" do
4
+ mode 0644
5
+ content node[:test][:data]
6
+ end
@@ -0,0 +1,3 @@
1
+ # Chef Solo Basic Skeleton
2
+
3
+ This is a skeleton that contains a basic chef solo setup.
@@ -0,0 +1,5 @@
1
+ # Just create a file
2
+ file "/vagrant/chef_solo" do
3
+ mode 0644
4
+ content "success"
5
+ end
@@ -1,5 +1,5 @@
1
1
  require File.expand_path("../base", __FILE__)
2
- require "support/shared/command_examples"
2
+ require "acceptance/support/shared/command_examples"
3
3
 
4
4
  describe "vagrant ssh" do
5
5
  include_context "acceptance"
@@ -32,8 +32,13 @@ describe "vagrant ssh" do
32
32
  assert_execute("vagrant", "init")
33
33
  assert_execute("vagrant", "up")
34
34
 
35
- result = assert_execute("vagrant", "ssh", "-c", "echo foo")
35
+ result = execute("vagrant", "ssh", "-c", "echo foo")
36
+ result.exit_code.should == 0
36
37
  result.stdout.should == "foo\n"
38
+
39
+ result = execute("vagrant", "ssh", "-c", "foooooooooo")
40
+ result.exit_code.should == 127
41
+ result.stderr.should =~ /foooooooooo: command not found/
37
42
  end
38
43
 
39
44
  # TODO:
@@ -11,7 +11,7 @@ module Acceptance
11
11
  attr_reader :box_directory
12
12
 
13
13
  def initialize(path)
14
- @logger = Log4r::Logger.new("acceptance::config")
14
+ @logger = Log4r::Logger.new("test::acceptance::config")
15
15
  @logger.info("Loading configuration from: #{path}")
16
16
  options = YAML.load_file(path)
17
17
  @logger.info("Loaded: #{options.inspect}")