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
@@ -1,11 +0,0 @@
1
- module Vagrant
2
- class Action
3
- module Box
4
- autoload :Destroy, 'vagrant/action/box/destroy'
5
- autoload :Download, 'vagrant/action/box/download'
6
- autoload :Package, 'vagrant/action/box/package'
7
- autoload :Unpackage, 'vagrant/action/box/unpackage'
8
- autoload :Verify, 'vagrant/action/box/verify'
9
- end
10
- end
11
- end
@@ -1,7 +0,0 @@
1
- module Vagrant
2
- class Action
3
- module Env
4
- autoload :Set, 'vagrant/action/env/set'
5
- end
6
- end
7
- end
@@ -1,8 +0,0 @@
1
- module Vagrant
2
- class Action
3
- module General
4
- autoload :Package, 'vagrant/action/general/package'
5
- autoload :Validate, 'vagrant/action/general/validate'
6
- end
7
- end
8
- end
@@ -1,28 +0,0 @@
1
- module Vagrant
2
- class Action
3
- module VM
4
- # Helper methods for forwarding ports. Requires that the environment
5
- # is set to the `@env` instance variable.
6
- module ForwardPortsHelpers
7
- # Returns an array of used ports. This method is implemented
8
- # differently depending on the VirtualBox version, but the
9
- # behavior is the same.
10
- #
11
- # @return [Array<String>]
12
- def used_ports
13
- result = VirtualBox::VM.all.collect do |vm|
14
- if vm.accessible? && vm.running? && vm.uuid != @env["vm"].uuid
15
- vm.network_adapters.collect do |na|
16
- na.nat_driver.forwarded_ports.collect do |fp|
17
- fp.hostport.to_i
18
- end
19
- end
20
- end
21
- end
22
-
23
- result.flatten.uniq
24
- end
25
- end
26
- end
27
- end
28
- end
@@ -1,37 +0,0 @@
1
- module Vagrant
2
- class Action
3
- module VM
4
- # This class allows other actions on the virtual machine object
5
- # to be consolidated under a single write lock. This vastly speeds
6
- # up modification of virtual machines. This should be used whereever
7
- # possible when dealing with virtual machine modifications.
8
- class Modify
9
- include Util::StackedProcRunner
10
-
11
- def initialize(app, env)
12
- @app = app
13
-
14
- # Initialize the proc_stack, which should already be empty
15
- # but just making sure here.
16
- proc_stack.clear
17
-
18
- # Create the lambda in the environment which is to be called
19
- # to add new procs to the modification sequence.
20
- env["vm.modify"] = lambda do |*procs|
21
- procs.each { |p| push_proc(&p) }
22
- end
23
- end
24
-
25
- def call(env)
26
- # Run the procs we have saved up, save the machine, and reload
27
- # to verify we get the new settings
28
- run_procs!(env["vm"].vm)
29
- env["vm"].vm.save
30
- env["vm"].reload!
31
-
32
- @app.call(env)
33
- end
34
- end
35
- end
36
- end
37
- end
@@ -1,11 +0,0 @@
1
- module Vagrant
2
- class Action
3
- module VM
4
- module NFSHelpers
5
- def clear_nfs_exports(env)
6
- env["host"].nfs_cleanup if env["host"]
7
- end
8
- end
9
- end
10
- end
11
- end
@@ -1,34 +0,0 @@
1
- module Vagrant
2
- class Action
3
- module VM
4
- autoload :Boot, 'vagrant/action/vm/boot'
5
- autoload :CheckAccessible, 'vagrant/action/vm/check_accessible'
6
- autoload :CheckBox, 'vagrant/action/vm/check_box'
7
- autoload :CheckGuestAdditions, 'vagrant/action/vm/check_guest_additions'
8
- autoload :CleanMachineFolder, 'vagrant/action/vm/clean_machine_folder'
9
- autoload :ClearForwardedPorts, 'vagrant/action/vm/clear_forwarded_ports'
10
- autoload :ClearNFSExports, 'vagrant/action/vm/clear_nfs_exports'
11
- autoload :ClearSharedFolders, 'vagrant/action/vm/clear_shared_folders'
12
- autoload :Customize, 'vagrant/action/vm/customize'
13
- autoload :Destroy, 'vagrant/action/vm/destroy'
14
- autoload :DestroyUnusedNetworkInterfaces, 'vagrant/action/vm/destroy_unused_network_interfaces'
15
- autoload :DiscardState, 'vagrant/action/vm/discard_state'
16
- autoload :Export, 'vagrant/action/vm/export'
17
- autoload :ForwardPorts, 'vagrant/action/vm/forward_ports'
18
- autoload :Halt, 'vagrant/action/vm/halt'
19
- autoload :HostName, 'vagrant/action/vm/host_name'
20
- autoload :Import, 'vagrant/action/vm/import'
21
- autoload :MatchMACAddress, 'vagrant/action/vm/match_mac_address'
22
- autoload :Modify, 'vagrant/action/vm/modify'
23
- autoload :Network, 'vagrant/action/vm/network'
24
- autoload :NFS, 'vagrant/action/vm/nfs'
25
- autoload :Package, 'vagrant/action/vm/package'
26
- autoload :PackageVagrantfile, 'vagrant/action/vm/package_vagrantfile'
27
- autoload :Provision, 'vagrant/action/vm/provision'
28
- autoload :ProvisionerCleanup, 'vagrant/action/vm/provisioner_cleanup'
29
- autoload :Resume, 'vagrant/action/vm/resume'
30
- autoload :ShareFolders, 'vagrant/action/vm/share_folders'
31
- autoload :Suspend, 'vagrant/action/vm/suspend'
32
- end
33
- end
34
- end
@@ -1,107 +0,0 @@
1
- require 'thor'
2
- require 'thor/actions'
3
-
4
- module Vagrant
5
- module Command
6
- # A {GroupBase} is the superclass which should be used if you're
7
- # creating a CLI command which has subcommands such as `vagrant box`,
8
- # which has subcommands such as `add`, `remove`, `list`. If you're
9
- # creating a simple command which has no subcommands, such as `vagrant up`,
10
- # then use {Base} instead.
11
- #
12
- # Unlike {Base}, where all public methods are executed, in a {GroupBase},
13
- # each public method defines a separate task which can be invoked. The best
14
- # way to get examples of how to create a {GroupBase} command is to look
15
- # at the built-in commands, such as {BoxCommand}.
16
- #
17
- # # Defining a New Command
18
- #
19
- # To define a new command with subcommands, create a new class which inherits
20
- # from this class, then call {register} to register the command. That's it! When
21
- # the command is invoked, the method matching the subcommand is invoked. An
22
- # example is shown below:
23
- #
24
- # class SayCommand < Vagrant::Command::GroupBase
25
- # register "say", "Say hello or goodbye"
26
- #
27
- # desc "hello", "say hello"
28
- # def hello
29
- # env.ui.info "Hello"
30
- # end
31
- #
32
- # desc "goodbye", "say goodbye"
33
- # def goodbye
34
- # env.ui.info "Goodbye"
35
- # end
36
- # end
37
- #
38
- # In this case, the above class is invokable via `vagrant say hello` or
39
- # `vagrant say goodbye`. To give it a try yourself, just copy and paste
40
- # the above into a Vagrantfile somewhere, and run `vagrant` from within
41
- # that directory. You should see the new command!
42
- #
43
- # Also notice that in the above, each task follows a `desc` call. This
44
- # call is used to provide usage and description for each task, and is
45
- # required.
46
- #
47
- # ## Defining Command-line Options
48
- #
49
- # ### Arguments
50
- #
51
- # To define arguments to your commands, such as `vagrant say hello mitchell`,
52
- # then you simply define them as arguments to the method implementing the
53
- # task. An example is shown below (only the method, to keep things brief):
54
- #
55
- # def hello(name)
56
- # env.ui.info "Hello, #{name}"
57
- # end
58
- #
59
- # Then, if `vagrant say hello mitchell` was called, then the output would
60
- # be "Hello, mitchell"
61
- #
62
- # ### Switches or Other Options
63
- #
64
- # TODO
65
- class GroupBase < Thor
66
- include Thor::Actions
67
- include Helpers
68
-
69
- attr_reader :env
70
-
71
- # Register the command with the main Vagrant CLI under the given
72
- # usage. The usage will be used for accessing it from the CLI,
73
- # so if you give it a usage of `lamp [subcommand]`, then the command
74
- # to invoke this will be `vagrant lamp` (with a subcommand).
75
- #
76
- # The description is used when a listing of the commands is given
77
- # and is meant to be a brief (one sentence) description of what this
78
- # command does.
79
- #
80
- # Some additional options may be passed in as the last parameter:
81
- #
82
- # * `:alias` - If given as an array or string, these will be aliases
83
- # for the same command. For example, `vagrant version` is also
84
- # `vagrant --version` and `vagrant -v`
85
- #
86
- # @param [String] usage
87
- # @param [String] description
88
- # @param [Hash] opts
89
- def self.register(usage, description, opts=nil)
90
- @_name = Base.extract_name_from_usage(usage)
91
- CLI.register(self, @_name, usage, description, opts)
92
- end
93
-
94
- def initialize(*args)
95
- super
96
- initialize_environment(*args)
97
- end
98
-
99
- protected
100
-
101
- # Override the basename to include the subcommand name.
102
- def self.basename
103
- "#{super} #{@_name}"
104
- end
105
- end
106
- end
107
- end
@@ -1,33 +0,0 @@
1
- module Vagrant
2
- module Command
3
- module Helpers
4
- # Initializes the environment by pulling the environment out of
5
- # the configuration hash and sets up the UI if necessary.
6
- def initialize_environment(args, options, config)
7
- raise Errors::CLIMissingEnvironment if !config[:env]
8
- @env = config[:env]
9
- end
10
-
11
- # This returns an array of {VM} objects depending on the arguments
12
- # given to the command.
13
- def target_vms(name=nil)
14
- raise Errors::NoEnvironmentError if !env.root_path
15
-
16
- name ||= self.name rescue nil
17
-
18
- @target_vms ||= begin
19
- if env.multivm?
20
- return env.vms_ordered if !name
21
- vm = env.vms[name.to_sym]
22
- raise Errors::VMNotFoundError, :name => name if !vm
23
- else
24
- raise Errors::MultiVMEnvironmentRequired if name
25
- vm = env.vms.values.first
26
- end
27
-
28
- [vm]
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,14 +0,0 @@
1
- module Vagrant
2
- module Command
3
- # Same as {Base} except adds the `name` argument for you. This superclass
4
- # is useful if you're creating a command which should be able to target
5
- # a specific VM in a multi-VM environment. For example, in a multi-VM
6
- # environment, `vagrant up` "ups" all defined VMs, but you can specify a
7
- # name such as `vagrant up web` to target only a specific VM. That name
8
- # argument is from {NamedBase}. Of course, you can always add it manually
9
- # yourself, as well.
10
- class NamedBase < Base
11
- argument :name, :type => :string, :optional => true
12
- end
13
- end
14
- end
@@ -1,45 +0,0 @@
1
- require 'fileutils'
2
-
3
- module Vagrant
4
- module Command
5
- class UpgradeTo060Command < Base
6
- register "upgrade_to_060", "Upgrade pre-0.6.0 environment to 0.6.0", :hide => true
7
-
8
- def execute
9
- @env.ui.warn I18n.t("vagrant.commands.upgrade_to_060.info"), :prefix => false
10
- @env.ui.warn "", :prefix => false
11
- if !@env.ui.yes? I18n.t("vagrant.commands.upgrade_to_060.ask"), :prefix => false, :color => :yellow
12
- @env.ui.info I18n.t("vagrant.commands.upgrade_to_060.quit"), :prefix => false
13
- return
14
- end
15
-
16
- local_data = @env.local_data
17
- if !local_data.empty?
18
- if local_data[:active]
19
- @env.ui.confirm I18n.t("vagrant.commands.upgrade_to_060.already_done"), :prefix => false
20
- return
21
- end
22
-
23
- # Backup the previous file
24
- @env.ui.info I18n.t("vagrant.commands.upgrade_to_060.backing_up"), :prefix => false
25
- FileUtils.cp(local_data.file_path, "#{local_data.file_path}.bak-#{Time.now.to_i}")
26
-
27
- # Gather the previously set virtual machines into a single
28
- # active hash
29
- active = local_data.inject({}) do |acc, data|
30
- key, uuid = data
31
- acc[key.to_sym] = uuid
32
- acc
33
- end
34
-
35
- # Set the active hash to the active list and save it
36
- local_data.clear
37
- local_data[:active] = active
38
- local_data.commit
39
- end
40
-
41
- @env.ui.confirm I18n.t("vagrant.commands.upgrade_to_060.complete"), :prefix => false
42
- end
43
- end
44
- end
45
- end
@@ -1,13 +0,0 @@
1
- module Vagrant
2
- module Command
3
- class VersionCommand < Base
4
- register "version", "Prints the Vagrant version information", :alias => %w(-v --version)
5
-
6
- def version
7
- env.ui.info(I18n.t("vagrant.commands.version.output",
8
- :version => Vagrant::VERSION),
9
- :prefix => false)
10
- end
11
- end
12
- end
13
- end
@@ -1,136 +0,0 @@
1
- module Vagrant
2
- class SSH
3
- # A helper class which wraps around `Net::SSH::Connection::Session`
4
- # in order to provide basic command error checking while still
5
- # providing access to the actual session object.
6
- class Session
7
- include Util::Retryable
8
-
9
- attr_reader :session
10
- attr_reader :env
11
-
12
- def initialize(session, env)
13
- @session = session
14
- @env = env
15
- end
16
-
17
- # Executes a given command and simply returns true/false if the
18
- # command succeeded or not.
19
- def test?(command)
20
- exec!(command) do |ch, type, data|
21
- return true if type == :exit_status && data == 0
22
- end
23
-
24
- false
25
- end
26
-
27
- # Executes a given command on the SSH session using `sudo` and
28
- # blocks until the command completes. This takes the same parameters
29
- # as {#exec!}. The only difference is that the command can be an
30
- # array of commands, which will be placed into the same script.
31
- #
32
- # This is different than just calling {#exec!} with `sudo`, since
33
- # this command is tailor-made to be compliant with older versions
34
- # of `sudo`.
35
- def sudo!(commands, options=nil, &block)
36
- channel = session.open_channel do |ch|
37
- ch.exec("sudo -H #{env.config.ssh.shell} -l") do |ch2, success|
38
- # Set the terminal
39
- ch2.send_data "export TERM=vt100\n"
40
-
41
- # Output each command as if they were entered on the command line
42
- [commands].flatten.each do |command|
43
- ch2.send_data "#{command}\n"
44
- end
45
-
46
- # Remember to exit or we'll hang!
47
- ch2.send_data "exit\n"
48
-
49
- # Setup the callbacks with our options so we get all the
50
- # stdout/stderr and error checking goodies
51
- setup_channel_callbacks(ch2, commands, options, block)
52
- end
53
- end
54
-
55
- channel.wait
56
- channel[:result]
57
- end
58
-
59
- # Executes a given command on the SSH session and blocks until
60
- # the command completes. This is an almost line for line copy of
61
- # the actual `exec!` implementation, except that this
62
- # implementation also reports `:exit_status` to the block if given.
63
- def exec!(commands, options=nil, &block)
64
- retryable(:tries => env.config.ssh.max_tries, :on => [IOError, Net::SSH::Disconnect], :sleep => 1.0) do
65
- metach = session.open_channel do |ch|
66
- ch.exec("#{env.config.ssh.shell} -l") do |ch2, success|
67
- # Set the terminal
68
- ch2.send_data "export TERM=vt100\n"
69
-
70
- # Output the commands as if they were entered on the command line
71
- [commands].flatten.each do |command|
72
- ch2.send_data "#{command}\n"
73
- end
74
-
75
- # Remember to exit
76
- ch2.send_data "exit\n"
77
-
78
- # Setup the callbacks
79
- setup_channel_callbacks(ch2, commands, options, block)
80
- end
81
- end
82
-
83
- metach.wait
84
- metach[:result]
85
- end
86
- end
87
-
88
- # Sets up the channel callbacks to properly check exit statuses and
89
- # callback on stdout/stderr.
90
- def setup_channel_callbacks(channel, command, options, block)
91
- options = { :error_check => true }.merge(options || {})
92
-
93
- block ||= Proc.new do |ch, type, data|
94
- check_exit_status(data, command, options, ch[:result]) if type == :exit_status && options[:error_check]
95
-
96
- ch[:result] ||= ""
97
- ch[:result] << data if [:stdout, :stderr].include?(type)
98
- end
99
-
100
- # Output stdout data to the block
101
- channel.on_data do |ch2, data|
102
- # This clears the screen, we want to filter it out.
103
- data.gsub!("\e[H", "")
104
-
105
- block.call(ch2, :stdout, data)
106
- end
107
-
108
- # Output stderr data to the block
109
- channel.on_extended_data do |ch2, type, data|
110
- block.call(ch2, :stderr, data)
111
- end
112
-
113
- # Output exit status information to the block
114
- channel.on_request("exit-status") do |ch2, data|
115
- block.call(ch2, :exit_status, data.read_long)
116
- end
117
- end
118
-
119
- # Checks for an erroroneous exit status and raises an exception
120
- # if so.
121
- def check_exit_status(exit_status, commands, options=nil, output=nil)
122
- if exit_status != 0
123
- output ||= '[no output]'
124
- options = {
125
- :_error_class => Errors::VagrantError,
126
- :_key => :ssh_bad_exit_status,
127
- :command => [commands].flatten.join("\n"),
128
- :output => output
129
- }.merge(options || {})
130
-
131
- raise options[:_error_class], options
132
- end
133
- end
134
- end
135
- end
136
- end
@@ -1,34 +0,0 @@
1
- module Vagrant
2
- module Systems
3
- class Arch < Linux
4
- def change_host_name(name)
5
- vm.ssh.execute do |ssh|
6
- # Only do this if the hostname is not already set
7
- if !ssh.test?("sudo hostname | grep '#{name}'")
8
- ssh.exec!("sudo sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/rc.conf")
9
- ssh.exec!("sudo hostname #{name}")
10
- ssh.exec!("sudo sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} @' /etc/hosts")
11
- end
12
- end
13
- end
14
-
15
- def prepare_host_only_network(net_options=nil)
16
- vm.ssh.execute do |ssh|
17
- ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/rc.conf > /tmp/vagrant-network-interfaces")
18
- ssh.exec!("sudo su -c 'cat /tmp/vagrant-network-interfaces > /etc/rc.conf'")
19
- end
20
- end
21
-
22
- def enable_host_only_network(net_options)
23
- entry = TemplateRenderer.render('network_entry_arch', :net_options => net_options)
24
- vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry")
25
-
26
- vm.ssh.execute do |ssh|
27
- ssh.exec!("sudo su -c 'cat /tmp/vagrant-network-entry >> /etc/rc.conf'")
28
- ssh.exec!("sudo /etc/rc.d/network restart")
29
- ssh.exec!("sudo su -c 'dhcpcd -k eth0 && dhcpcd eth0 & sleep 3'")
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,36 +0,0 @@
1
- module Vagrant
2
- module Systems
3
- class Debian < Linux
4
- def prepare_host_only_network(net_options=nil)
5
- # Remove any previous host only network additions to the
6
- # interface file.
7
- vm.ssh.execute do |ssh|
8
- # Clear out any previous entries
9
- ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces")
10
- ssh.exec!("sudo su -c 'cat /tmp/vagrant-network-interfaces > /etc/network/interfaces'")
11
- end
12
- end
13
-
14
- def enable_host_only_network(net_options)
15
- entry = TemplateRenderer.render('network_entry_debian', :net_options => net_options)
16
- vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry")
17
-
18
- vm.ssh.execute do |ssh|
19
- ssh.exec!("sudo /sbin/ifdown eth#{net_options[:adapter]} 2> /dev/null")
20
- ssh.exec!("sudo su -c 'cat /tmp/vagrant-network-entry >> /etc/network/interfaces'")
21
- ssh.exec!("sudo /sbin/ifup eth#{net_options[:adapter]}")
22
- end
23
- end
24
-
25
- def change_host_name(name)
26
- vm.ssh.execute do |ssh|
27
- if !ssh.test?("sudo hostname | grep '#{name}'")
28
- ssh.exec!("sudo sed -i 's@^\\(127[.]0[.]1[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
29
- ssh.exec!("sudo sed -i 's/.*$/#{name}/' /etc/hostname")
30
- ssh.exec!("sudo hostname -F /etc/hostname")
31
- end
32
- end
33
- end
34
- end
35
- end
36
- end
@@ -1,27 +0,0 @@
1
- module Vagrant
2
- module Systems
3
- class Gentoo < Linux
4
- def prepare_host_only_network(net_options=nil)
5
- # Remove any previous host only network additions to the
6
- # interface file.
7
- vm.ssh.execute do |ssh|
8
- # Clear out any previous entries
9
- ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/conf.d/net > /tmp/vagrant-network-interfaces")
10
- ssh.exec!("sudo su -c 'cat /tmp/vagrant-network-interfaces > /etc/conf.d/net'")
11
- end
12
- end
13
-
14
- def enable_host_only_network(net_options)
15
- entry = TemplateRenderer.render('network_entry_gentoo', :net_options => net_options)
16
- vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry")
17
-
18
- vm.ssh.execute do |ssh|
19
- ssh.exec!("sudo ln -fs /etc/init.d/net.lo /etc/init.d/net.eth#{net_options[:adapter]}")
20
- ssh.exec!("sudo /etc/init.d/net.eth#{net_options[:adapter]} stop 2> /dev/null")
21
- ssh.exec!("sudo su -c 'cat /tmp/vagrant-network-entry >> /etc/conf.d/net'")
22
- ssh.exec!("sudo /etc/init.d/net.eth#{net_options[:adapter]} start")
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,9 +0,0 @@
1
- module Vagrant
2
- module Systems
3
- class Linux < Vagrant::Systems::Base
4
- class LinuxError < Errors::VagrantError
5
- error_namespace("vagrant.systems.linux")
6
- end
7
- end
8
- end
9
- end