vagrant-unbundled 1.8.1.2 → 1.8.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (348) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -13
  3. data/.travis.yml +3 -0
  4. data/CHANGELOG.md +167 -4
  5. data/LICENSE +1 -1
  6. data/README.md +7 -9
  7. data/RELEASE.md +28 -0
  8. data/bin/vagrant +1 -1
  9. data/contrib/bash/completion.sh +6 -1
  10. data/contrib/sudoers/linux-fedora +1 -1
  11. data/keys/README.md +1 -1
  12. data/lib/vagrant/action/builtin/box_add.rb +7 -3
  13. data/lib/vagrant/action/general/package.rb +47 -13
  14. data/lib/vagrant/box.rb +1 -1
  15. data/lib/vagrant/box_collection.rb +3 -4
  16. data/lib/vagrant/bundler.rb +29 -11
  17. data/lib/vagrant/machine.rb +14 -5
  18. data/lib/vagrant/ui.rb +1 -1
  19. data/lib/vagrant/util/is_port_open.rb +1 -1
  20. data/lib/vagrant/util/platform.rb +67 -42
  21. data/plugins/commands/box/command/remove.rb +1 -1
  22. data/plugins/commands/box/command/update.rb +10 -0
  23. data/plugins/commands/destroy/command.rb +1 -1
  24. data/plugins/commands/halt/command.rb +1 -1
  25. data/plugins/commands/init/command.rb +8 -2
  26. data/plugins/commands/login/client.rb +19 -1
  27. data/plugins/commands/package/command.rb +1 -1
  28. data/plugins/commands/plugin/command/mixin_install_opts.rb +1 -1
  29. data/plugins/commands/plugin/gem_helper.rb +1 -1
  30. data/plugins/commands/port/command.rb +1 -1
  31. data/plugins/commands/rdp/command.rb +1 -1
  32. data/plugins/commands/resume/command.rb +15 -1
  33. data/plugins/commands/snapshot/command/pop.rb +16 -1
  34. data/plugins/commands/snapshot/command/push_shared.rb +7 -9
  35. data/plugins/commands/snapshot/command/restore.rb +14 -1
  36. data/plugins/commands/ssh/command.rb +2 -1
  37. data/plugins/commands/ssh_config/command.rb +1 -1
  38. data/plugins/commands/status/command.rb +1 -1
  39. data/plugins/commands/suspend/command.rb +1 -1
  40. data/plugins/commands/up/command.rb +4 -4
  41. data/plugins/communicators/ssh/communicator.rb +2 -2
  42. data/plugins/communicators/winrm/communicator.rb +11 -11
  43. data/plugins/communicators/winrm/config.rb +7 -1
  44. data/plugins/communicators/winrm/shell.rb +41 -41
  45. data/plugins/guests/amazon/cap/flavor.rb +14 -0
  46. data/plugins/guests/amazon/guest.rb +9 -0
  47. data/plugins/guests/amazon/plugin.rb +20 -0
  48. data/plugins/guests/arch/cap/change_host_name.rb +15 -6
  49. data/plugins/guests/arch/cap/configure_networks.rb +33 -14
  50. data/plugins/guests/arch/plugin.rb +1 -1
  51. data/plugins/guests/atomic/cap/change_host_name.rb +16 -1
  52. data/plugins/guests/atomic/plugin.rb +2 -2
  53. data/plugins/guests/coreos/cap/change_host_name.rb +10 -4
  54. data/plugins/guests/coreos/cap/configure_networks.rb +49 -37
  55. data/plugins/guests/coreos/guest.rb +2 -0
  56. data/plugins/guests/coreos/plugin.rb +1 -1
  57. data/plugins/guests/darwin/cap/change_host_name.rb +25 -7
  58. data/plugins/guests/darwin/cap/choose_addressable_ip_addr.rb +7 -7
  59. data/plugins/guests/darwin/cap/insert_public_key.rb +19 -7
  60. data/plugins/guests/darwin/guest.rb +1 -1
  61. data/plugins/guests/darwin/plugin.rb +1 -1
  62. data/plugins/guests/debian/cap/change_host_name.rb +37 -84
  63. data/plugins/guests/debian/cap/configure_networks.rb +61 -46
  64. data/plugins/guests/debian/cap/nfs_client.rb +5 -4
  65. data/plugins/guests/debian/cap/rsync.rb +6 -3
  66. data/plugins/guests/debian/cap/smb.rb +6 -7
  67. data/plugins/guests/debian/guest.rb +2 -0
  68. data/plugins/guests/debian/plugin.rb +1 -1
  69. data/plugins/guests/fedora/cap/change_host_name.rb +18 -64
  70. data/plugins/guests/fedora/cap/configure_networks.rb +10 -9
  71. data/plugins/guests/fedora/plugin.rb +1 -1
  72. data/plugins/guests/freebsd/cap/change_host_name.rb +21 -3
  73. data/plugins/guests/freebsd/cap/configure_networks.rb +45 -30
  74. data/plugins/guests/freebsd/cap/halt.rb +1 -1
  75. data/plugins/guests/freebsd/cap/insert_public_key.rb +21 -8
  76. data/plugins/guests/freebsd/cap/mount_nfs_folder.rb +10 -7
  77. data/plugins/guests/freebsd/cap/rsync.rb +1 -11
  78. data/plugins/guests/freebsd/plugin.rb +1 -1
  79. data/plugins/guests/funtoo/cap/configure_networks.rb +10 -6
  80. data/plugins/guests/gentoo/cap/configure_networks.rb +9 -8
  81. data/plugins/guests/linux/cap/choose_addressable_ip_addr.rb +6 -6
  82. data/plugins/guests/linux/cap/insert_public_key.rb +18 -8
  83. data/plugins/guests/linux/cap/mount_nfs.rb +16 -12
  84. data/plugins/guests/linux/cap/mount_smb_shared_folder.rb +2 -2
  85. data/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb +1 -1
  86. data/plugins/guests/linux/guest.rb +0 -2
  87. data/plugins/guests/linux/plugin.rb +1 -1
  88. data/plugins/guests/mint/guest.rb +0 -2
  89. data/plugins/guests/mint/plugin.rb +1 -1
  90. data/plugins/guests/netbsd/cap/configure_networks.rb +8 -8
  91. data/plugins/guests/nixos/cap/change_host_name.rb +11 -8
  92. data/plugins/guests/nixos/cap/configure_networks.rb +12 -9
  93. data/plugins/guests/omnios/cap/change_host_name.rb +17 -5
  94. data/plugins/guests/omnios/cap/mount_nfs_folder.rb +10 -4
  95. data/plugins/guests/omnios/cap/rsync.rb +11 -0
  96. data/plugins/guests/omnios/guest.rb +0 -2
  97. data/plugins/guests/omnios/plugin.rb +6 -1
  98. data/plugins/guests/openbsd/cap/configure_networks.rb +8 -6
  99. data/plugins/guests/photon/cap/change_host_name.rb +17 -4
  100. data/plugins/guests/photon/cap/configure_networks.rb +14 -26
  101. data/plugins/guests/photon/guest.rb +1 -1
  102. data/plugins/guests/photon/plugin.rb +12 -12
  103. data/plugins/guests/pld/cap/change_host_name.rb +21 -9
  104. data/plugins/guests/pld/guest.rb +0 -2
  105. data/plugins/guests/pld/plugin.rb +1 -1
  106. data/plugins/guests/redhat/cap/change_host_name.rb +30 -96
  107. data/plugins/guests/redhat/cap/configure_networks.rb +44 -50
  108. data/plugins/guests/redhat/cap/flavor.rb +3 -4
  109. data/plugins/guests/redhat/cap/nfs_client.rb +13 -25
  110. data/plugins/guests/redhat/cap/rsync.rb +6 -6
  111. data/plugins/guests/redhat/guest.rb +0 -2
  112. data/plugins/guests/redhat/plugin.rb +1 -10
  113. data/plugins/guests/slackware/cap/change_host_name.rb +19 -8
  114. data/plugins/guests/slackware/cap/configure_networks.rb +30 -14
  115. data/plugins/guests/slackware/guest.rb +0 -2
  116. data/plugins/guests/slackware/plugin.rb +1 -1
  117. data/plugins/guests/smartos/config.rb +3 -15
  118. data/plugins/guests/suse/cap/change_host_name.rb +15 -7
  119. data/plugins/guests/suse/cap/configure_networks.rb +31 -37
  120. data/plugins/guests/suse/cap/nfs_client.rb +5 -6
  121. data/plugins/guests/suse/cap/rsync.rb +1 -3
  122. data/plugins/guests/suse/guest.rb +0 -2
  123. data/plugins/guests/suse/plugin.rb +1 -1
  124. data/plugins/guests/tinycore/cap/mount_nfs.rb +46 -0
  125. data/plugins/guests/tinycore/plugin.rb +5 -0
  126. data/plugins/guests/trisquel/guest.rb +9 -0
  127. data/plugins/guests/trisquel/plugin.rb +15 -0
  128. data/plugins/guests/ubuntu/cap/change_host_name.rb +42 -41
  129. data/plugins/guests/ubuntu/guest.rb +0 -2
  130. data/plugins/guests/ubuntu/plugin.rb +1 -3
  131. data/plugins/guests/windows/guest_network.rb +1 -1
  132. data/plugins/hosts/arch/cap/nfs.rb +3 -19
  133. data/plugins/hosts/darwin/cap/provider_install_virtualbox.rb +4 -5
  134. data/plugins/hosts/darwin/cap/rdp.rb +34 -6
  135. data/plugins/hosts/gentoo/cap/nfs.rb +1 -1
  136. data/plugins/hosts/windows/cap/provider_install_virtualbox.rb +4 -5
  137. data/plugins/hosts/windows/cap/ps.rb +2 -2
  138. data/plugins/hosts/windows/cap/rdp.rb +8 -17
  139. data/plugins/kernel_v2/config/ssh_connect.rb +6 -0
  140. data/plugins/kernel_v2/config/vm.rb +3 -1
  141. data/plugins/providers/docker/action.rb +3 -3
  142. data/plugins/providers/docker/action/create.rb +1 -1
  143. data/plugins/providers/docker/command/exec.rb +104 -0
  144. data/plugins/providers/docker/config.rb +9 -1
  145. data/plugins/providers/docker/errors.rb +4 -0
  146. data/plugins/providers/docker/plugin.rb +6 -0
  147. data/plugins/providers/docker/provider.rb +1 -2
  148. data/plugins/providers/hyperv/action.rb +56 -1
  149. data/plugins/providers/hyperv/action/import.rb +13 -5
  150. data/plugins/providers/hyperv/action/snapshot_delete.rb +27 -0
  151. data/plugins/providers/hyperv/action/snapshot_restore.rb +23 -0
  152. data/plugins/providers/hyperv/action/snapshot_save.rb +27 -0
  153. data/plugins/providers/hyperv/cap/snapshot_list.rb +11 -0
  154. data/plugins/providers/hyperv/config.rb +5 -2
  155. data/plugins/providers/hyperv/driver.rb +18 -1
  156. data/plugins/providers/hyperv/plugin.rb +5 -0
  157. data/plugins/providers/hyperv/scripts/clone_vhd.ps1 +9 -0
  158. data/plugins/providers/hyperv/scripts/create_snapshot.ps1 +8 -0
  159. data/plugins/providers/hyperv/scripts/delete_snapshot.ps1 +8 -0
  160. data/plugins/providers/hyperv/scripts/get_vm_status.ps1 +8 -2
  161. data/plugins/providers/hyperv/scripts/import_vm.ps1 +5 -1
  162. data/plugins/providers/hyperv/scripts/list_snapshots.ps1 +12 -0
  163. data/plugins/providers/hyperv/scripts/restore_snapshot.ps1 +8 -0
  164. data/plugins/providers/virtualbox/action.rb +9 -4
  165. data/plugins/providers/virtualbox/action/import_master.rb +81 -75
  166. data/plugins/providers/virtualbox/action/package.rb +1 -29
  167. data/plugins/providers/virtualbox/action/package_setup_files.rb +51 -0
  168. data/plugins/providers/virtualbox/action/package_setup_folders.rb +38 -0
  169. data/plugins/providers/virtualbox/action/prepare_nfs_settings.rb +23 -1
  170. data/plugins/providers/virtualbox/action/setup_package_files.rb +9 -43
  171. data/plugins/providers/virtualbox/driver/version_4_1.rb +104 -6
  172. data/plugins/providers/virtualbox/driver/version_4_2.rb +6 -5
  173. data/plugins/providers/virtualbox/driver/version_4_3.rb +6 -5
  174. data/plugins/providers/virtualbox/driver/version_5_0.rb +6 -5
  175. data/plugins/provisioners/ansible/cap/guest/arch/ansible_install.rb +8 -3
  176. data/plugins/provisioners/ansible/cap/guest/debian/ansible_install.rb +26 -4
  177. data/plugins/provisioners/ansible/cap/guest/facts.rb +24 -0
  178. data/plugins/provisioners/ansible/cap/guest/fedora/ansible_install.rb +16 -6
  179. data/plugins/provisioners/ansible/cap/guest/freebsd/ansible_install.rb +7 -2
  180. data/plugins/provisioners/ansible/cap/guest/pip/pip.rb +28 -0
  181. data/plugins/provisioners/ansible/cap/guest/posix/ansible_installed.rb +1 -1
  182. data/plugins/provisioners/ansible/cap/guest/redhat/ansible_install.rb +24 -7
  183. data/plugins/provisioners/ansible/cap/guest/suse/ansible_install.rb +6 -2
  184. data/plugins/provisioners/ansible/cap/guest/ubuntu/ansible_install.rb +17 -6
  185. data/plugins/provisioners/ansible/config/base.rb +15 -23
  186. data/plugins/provisioners/ansible/config/guest.rb +9 -22
  187. data/plugins/provisioners/ansible/config/host.rb +9 -19
  188. data/plugins/provisioners/ansible/errors.rb +4 -0
  189. data/plugins/provisioners/ansible/helpers.rb +4 -24
  190. data/plugins/provisioners/ansible/provisioner/base.rb +58 -10
  191. data/plugins/provisioners/ansible/provisioner/guest.rb +55 -22
  192. data/plugins/provisioners/ansible/provisioner/host.rb +50 -9
  193. data/plugins/provisioners/chef/cap/linux/chef_installed.rb +2 -2
  194. data/plugins/provisioners/chef/cap/omnios/chef_installed.rb +3 -3
  195. data/plugins/provisioners/chef/cap/redhat/chef_install.rb +7 -11
  196. data/plugins/provisioners/chef/cap/suse/chef_install.rb +27 -0
  197. data/plugins/provisioners/chef/cap/windows/chef_installed.rb +1 -1
  198. data/plugins/provisioners/chef/command_builder.rb +1 -0
  199. data/plugins/provisioners/chef/config/base.rb +5 -6
  200. data/plugins/provisioners/chef/config/chef_solo.rb +6 -0
  201. data/plugins/provisioners/chef/installer.rb +2 -2
  202. data/plugins/provisioners/chef/omnibus.rb +1 -1
  203. data/plugins/provisioners/chef/plugin.rb +5 -0
  204. data/plugins/provisioners/chef/provisioner/base.rb +52 -56
  205. data/plugins/provisioners/chef/provisioner/chef_apply.rb +9 -10
  206. data/plugins/provisioners/chef/provisioner/chef_client.rb +1 -1
  207. data/plugins/provisioners/chef/provisioner/chef_solo.rb +1 -0
  208. data/plugins/provisioners/docker/client.rb +22 -4
  209. data/plugins/provisioners/puppet/provisioner/puppet.rb +3 -3
  210. data/plugins/provisioners/salt/provisioner.rb +19 -24
  211. data/plugins/pushes/ftp/adapter.rb +18 -1
  212. data/plugins/pushes/heroku/locales/en.yml +1 -1
  213. data/plugins/synced_folders/rsync/helper.rb +1 -1
  214. data/templates/commands/init/Vagrantfile.erb +6 -3
  215. data/templates/commands/init/Vagrantfile.min.erb +1 -1
  216. data/templates/commands/ssh_config/config.erb +5 -1
  217. data/templates/guests/debian/network_dhcp.erb +2 -2
  218. data/templates/guests/debian/network_static.erb +2 -2
  219. data/templates/guests/debian/network_static6.erb +2 -2
  220. data/templates/guests/fedora/network_static6.erb +9 -0
  221. data/templates/guests/freebsd/network_dhcp.erb +2 -1
  222. data/templates/guests/freebsd/network_static.erb +1 -1
  223. data/templates/guests/slackware/network_dhcp.erb +8 -20
  224. data/templates/guests/slackware/network_static.erb +10 -22
  225. data/templates/guests/suse/network_dhcp.erb +1 -1
  226. data/templates/guests/suse/network_static.erb +3 -3
  227. data/templates/locales/en.yml +35 -18
  228. data/templates/locales/providers_docker.yml +8 -0
  229. data/templates/provisioners/chef_solo/solo.erb +7 -7
  230. data/test/support/isolated_environment.rb +1 -1
  231. data/test/unit/base.rb +9 -1
  232. data/test/unit/plugins/commands/box/command/update_test.rb +7 -1
  233. data/test/unit/plugins/commands/init/command_test.rb +86 -0
  234. data/test/unit/plugins/commands/login/client_test.rb +7 -0
  235. data/test/unit/plugins/commands/ssh_config/command_test.rb +2 -14
  236. data/test/unit/plugins/communicators/winrm/shell_test.rb +40 -16
  237. data/test/unit/plugins/guests/amazon/cap/flavor_test.rb +19 -0
  238. data/test/unit/plugins/guests/arch/cap/change_host_name_test.rb +38 -0
  239. data/test/unit/plugins/guests/arch/cap/configure_networks_test.rb +55 -0
  240. data/test/unit/plugins/guests/atomic/cap/change_host_name_test.rb +38 -0
  241. data/test/unit/plugins/guests/atomic/cap/docker_test.rb +28 -0
  242. data/test/unit/plugins/guests/coreos/cap/change_host_name_test.rb +37 -0
  243. data/test/unit/plugins/guests/coreos/cap/configure_networks_test.rb +59 -0
  244. data/test/unit/plugins/guests/coreos/cap/docker_test.rb +28 -0
  245. data/test/unit/plugins/guests/darwin/cap/change_host_name_test.rb +40 -0
  246. data/test/unit/plugins/guests/darwin/cap/choose_addressable_ip_addr_test.rb +36 -0
  247. data/test/unit/plugins/guests/debian/cap/change_host_name_test.rb +23 -16
  248. data/test/unit/plugins/guests/debian/cap/configure_networks_test.rb +54 -0
  249. data/test/unit/plugins/guests/debian/cap/nfs_client_test.rb +30 -0
  250. data/test/unit/plugins/guests/debian/cap/rsync_test.rb +38 -0
  251. data/test/unit/plugins/guests/debian/cap/smb_test.rb +38 -0
  252. data/test/unit/plugins/guests/freebsd/cap/change_host_name_test.rb +40 -0
  253. data/test/unit/plugins/guests/freebsd/cap/configure_networks_test.rb +51 -0
  254. data/test/unit/plugins/guests/freebsd/cap/halt_test.rb +35 -0
  255. data/test/unit/plugins/guests/freebsd/cap/insert_public_key_test.rb +31 -0
  256. data/test/unit/plugins/guests/freebsd/cap/mount_nfs_folder_test.rb +53 -0
  257. data/test/unit/plugins/guests/freebsd/cap/rsync_test.rb +46 -0
  258. data/test/unit/plugins/guests/linux/cap/choose_addressable_ip_addr_test.rb +38 -0
  259. data/test/unit/plugins/guests/linux/cap/halt_test.rb +36 -0
  260. data/test/unit/plugins/guests/linux/cap/insert_public_key_test.rb +32 -0
  261. data/test/unit/plugins/guests/linux/cap/mount_nfs_test.rb +78 -0
  262. data/test/unit/plugins/guests/linux/cap/mount_shared_folder_test.rb +1 -1
  263. data/test/unit/plugins/guests/linux/cap/nfs_client_test.rb +29 -0
  264. data/test/unit/plugins/guests/linux/cap/port_test.rb +30 -0
  265. data/test/unit/plugins/guests/omnios/cap/change_host_name_test.rb +41 -0
  266. data/test/unit/plugins/guests/omnios/cap/mount_nfs_folder_test.rb +47 -0
  267. data/test/unit/plugins/guests/omnios/cap/rsync_test.rb +29 -0
  268. data/test/unit/plugins/guests/photon/cap/change_host_name_test.rb +26 -18
  269. data/test/unit/plugins/guests/photon/cap/configure_networks_test.rb +37 -26
  270. data/test/unit/plugins/guests/photon/cap/docker_test.rb +17 -12
  271. data/test/unit/plugins/guests/pld/cap/change_host_name_test.rb +39 -0
  272. data/test/unit/plugins/guests/pld/cap/flavor_test.rb +21 -0
  273. data/test/unit/plugins/guests/pld/cap/network_scripts_dir_test.rb +21 -0
  274. data/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb +23 -51
  275. data/test/unit/plugins/guests/redhat/cap/configure_networks_test.rb +80 -0
  276. data/test/unit/plugins/guests/redhat/cap/flavor_test.rb +40 -0
  277. data/test/unit/plugins/guests/redhat/cap/network_scripts_dir_test.rb +21 -0
  278. data/test/unit/plugins/guests/redhat/cap/nfs_client_test.rb +30 -0
  279. data/test/unit/plugins/guests/redhat/cap/rsync_test.rb +29 -0
  280. data/test/unit/plugins/guests/slackware/cap/change_host_name_test.rb +40 -0
  281. data/test/unit/plugins/guests/slackware/cap/configure_networks_test.rb +48 -0
  282. data/test/unit/plugins/guests/smartos/cap/change_host_name_test.rb +2 -2
  283. data/test/unit/plugins/guests/smartos/cap/configure_networks_test.rb +1 -1
  284. data/test/unit/plugins/guests/smartos/cap/halt_test.rb +1 -1
  285. data/test/unit/plugins/guests/smartos/cap/mount_nfs_test.rb +1 -1
  286. data/test/unit/plugins/guests/smartos/cap/rsync_test.rb +1 -1
  287. data/test/unit/plugins/guests/suse/cap/change_host_name_test.rb +40 -0
  288. data/test/unit/plugins/guests/suse/cap/configure_networks_test.rb +60 -0
  289. data/test/unit/plugins/guests/suse/cap/halt_test.rb +36 -0
  290. data/test/unit/plugins/guests/suse/cap/network_scripts_dir_test.rb +19 -0
  291. data/test/unit/plugins/guests/suse/cap/nfs_client_test.rb +31 -0
  292. data/test/unit/plugins/guests/suse/cap/rsync_test.rb +38 -0
  293. data/test/unit/plugins/guests/tinycore/cap/change_host_name_test.rb +1 -1
  294. data/test/unit/plugins/guests/ubuntu/cap/change_host_name_test.rb +24 -16
  295. data/test/unit/plugins/guests/windows/cap/change_host_name_test.rb +1 -1
  296. data/test/unit/plugins/guests/windows/cap/halt_test.rb +1 -1
  297. data/test/unit/plugins/guests/windows/cap/mount_shared_folder_test.rb +1 -1
  298. data/test/unit/plugins/guests/windows/cap/reboot_test.rb +1 -1
  299. data/test/unit/plugins/guests/windows/cap/rsync_test.rb +1 -1
  300. data/test/unit/plugins/hosts/darwin/cap/rdp_test.rb +36 -0
  301. data/test/unit/plugins/kernel_v2/config/vm_test.rb +27 -1
  302. data/test/unit/plugins/providers/docker/action/create_test.rb +55 -0
  303. data/test/unit/plugins/providers/docker/command/exec_test.rb +44 -0
  304. data/test/unit/plugins/providers/docker/config_test.rb +7 -2
  305. data/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb +18 -0
  306. data/test/unit/plugins/provisioners/ansible/config/guest_test.rb +83 -0
  307. data/test/unit/plugins/provisioners/ansible/config/host_test.rb +98 -0
  308. data/test/unit/plugins/provisioners/ansible/config/shared.rb +107 -0
  309. data/test/unit/plugins/provisioners/ansible/provisioner_test.rb +82 -10
  310. data/test/unit/plugins/provisioners/chef/config/base_test.rb +2 -2
  311. data/test/unit/plugins/provisioners/chef/provisioner/base_test.rb +29 -0
  312. data/test/unit/plugins/pushes/atlas/push_test.rb +12 -8
  313. data/test/unit/plugins/pushes/ftp/adapter_test.rb +1 -1
  314. data/test/unit/plugins/pushes/ftp/push_test.rb +5 -4
  315. data/test/unit/support/isolated_environment.rb +4 -4
  316. data/test/unit/support/shared/base_context.rb +11 -3
  317. data/test/unit/templates/guests/arch/network_dhcp_test.rb +2 -2
  318. data/test/unit/templates/guests/arch/network_static_test.rb +4 -4
  319. data/test/unit/templates/guests/debian/network_dhcp_test.rb +6 -6
  320. data/test/unit/templates/guests/debian/network_static_test.rb +6 -6
  321. data/test/unit/templates/guests/fedora/network_static6_test.rb +25 -0
  322. data/test/unit/templates/guests/freebsd/network_dhcp_test.rb +5 -2
  323. data/test/unit/templates/guests/freebsd/network_static_test.rb +13 -17
  324. data/test/unit/templates/guests/suse/network_dhcp_test.rb +2 -2
  325. data/test/unit/templates/guests/suse/network_static_test.rb +4 -4
  326. data/test/unit/vagrant/action/builtin/box_add_test.rb +33 -31
  327. data/test/unit/vagrant/action/builtin/lock_test.rb +5 -2
  328. data/test/unit/vagrant/action/builtin/mixin_synced_folders_test.rb +6 -2
  329. data/test/unit/vagrant/action/builtin/synced_folder_cleanup_test.rb +5 -1
  330. data/test/unit/vagrant/action/builtin/synced_folders_test.rb +5 -1
  331. data/test/unit/vagrant/box_collection_test.rb +19 -7
  332. data/test/unit/vagrant/box_test.rb +13 -2
  333. data/test/unit/vagrant/config_test.rb +1 -1
  334. data/test/unit/vagrant/environment_test.rb +16 -12
  335. data/test/unit/vagrant/machine_index_test.rb +5 -1
  336. data/test/unit/vagrant/machine_test.rb +5 -1
  337. data/test/unit/vagrant/plugin/manager_test.rb +1 -5
  338. data/test/unit/vagrant/plugin/state_file_test.rb +1 -5
  339. data/test/unit/vagrant/util/platform_test.rb +5 -0
  340. data/test/unit/vagrant/util/safe_chdir_test.rb +11 -5
  341. data/test/unit/vagrant/vagrantfile_test.rb +5 -1
  342. data/vagrant.gemspec +8 -3
  343. data/version.txt +1 -1
  344. metadata +3657 -12
  345. data/CONTRIBUTING.md +0 -41
  346. data/test/unit/plugins/guests/support/shared/debian_like_host_name_examples.rb +0 -106
  347. data/test/unit/plugins/guests/support/shared/redhat_like_host_name_examples.rb +0 -252
  348. data/test/unit/plugins/provisioners/ansible/config_test.rb +0 -224
data/CONTRIBUTING.md DELETED
@@ -1,41 +0,0 @@
1
- # How to contribute
2
-
3
- We like to encourage you to contribute to the repository.
4
- This should be as easy as possible for you but there are a few things to consider when contributing.
5
- The following guidelines for contribution should be followed if you want to submit a pull request.
6
-
7
- ## How to prepare
8
-
9
- * You need a [GitHub account](https://github.com/signup/free)
10
- * Submit an [issue ticket](https://github.com/mitchellh/vagrant/issues) for your issue if there is not one yet.
11
- * Describe the issue and include steps to reproduce when it's a bug.
12
- * Ensure to mention the earliest version that you know is affected.
13
- * If you plan on submitting a bug report, please submit debug-level logs along
14
- with the report using [gist](https://gist.github.com/) or some other paste
15
- service by prepending `VAGRANT_LOG=debug` to your `vagrant` commands.
16
- * Fork the repository on GitHub
17
-
18
- ## Make Changes
19
-
20
- * In your forked repository, create a topic branch for your upcoming patch.
21
- * Usually this is based on the master branch.
22
- * Create a branch based on master; `git branch
23
- fix/master/my_contribution master` then checkout the new branch with `git
24
- checkout fix/master/my_contribution`. Please avoid working directly on the `master` branch.
25
- * Make commits of logical units and describe them properly.
26
- * Check for unnecessary whitespace with `git diff --check` before committing.
27
-
28
- * If possible, submit tests to your patch / new feature so it can be tested easily.
29
- * Assure nothing is broken by running all the tests.
30
-
31
- ## Submit Changes
32
-
33
- * Push your changes to a topic branch in your fork of the repository.
34
- * Open a pull request to the original repository and choose the right original branch you want to patch.
35
- * If not done in commit messages (which you really should do) please reference and update your issue with the code changes.
36
- * Even if you have write access to the repository, do not directly push or merge pull-requests. Let another team member review your pull request and approve.
37
-
38
- # Additional Resources
39
-
40
- * [General GitHub documentation](http://help.github.com/)
41
- * [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
@@ -1,106 +0,0 @@
1
- shared_examples "a debian-like host name change" do
2
- it "updates /etc/hostname on the machine" do
3
- communicator.expect_command(%q(echo 'newhostname' > /etc/hostname))
4
- described_class.change_host_name(machine, 'newhostname.newdomain.tld')
5
- end
6
-
7
- it "updates mailname to prevent problems with the default mailer" do
8
- communicator.expect_command(%q(hostname --fqdn > /etc/mailname))
9
- described_class.change_host_name(machine, 'newhostname.newdomain.tld')
10
- end
11
-
12
- it "does nothing when the provided hostname is not different" do
13
- described_class.change_host_name(machine, 'oldhostname.olddomain.tld')
14
- expect(communicator.received_commands).to eq(['hostname -f'])
15
- end
16
-
17
- describe "flipping out the old hostname in /etc/hosts" do
18
- let(:sed_command) do
19
- # Here we run the change_host_name through and extract the recorded sed
20
- # command from the dummy communicator
21
- described_class.change_host_name(machine, 'newhostname.newdomain.tld')
22
- communicator.received_commands.find { |cmd| cmd =~ /^sed/ }
23
- end
24
-
25
- # Now we extract the regexp from that sed command so we can do some
26
- # verification on it
27
- let(:expression) { sed_command.sub(%r{^sed -ri '\(.*\)' /etc/hosts$}, "\1") }
28
- let(:search) { Regexp.new(expression.split('@')[1], Regexp::EXTENDED) }
29
- let(:replace) { expression.split('@')[2] }
30
-
31
- let(:grep_command) { "grep '#{old_hostname}' /etc/hosts" }
32
-
33
- before do
34
- communicator.stub_command(grep_command, exit_code: 0)
35
- end
36
-
37
- it "works on an simple /etc/hosts file" do
38
- original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
39
- 127.0.0.1 localhost
40
- 127.0.1.1 oldhostname.olddomain.tld oldhostname
41
- ETC_HOSTS
42
-
43
- modified_etc_hosts = original_etc_hosts.gsub(search, replace)
44
-
45
- expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
46
- 127.0.0.1 localhost
47
- 127.0.1.1 newhostname.newdomain.tld newhostname
48
- RESULT
49
- end
50
-
51
- it "does not modify lines which contain similar hostnames" do
52
- original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
53
- 127.0.0.1 localhost
54
- 127.0.1.1 oldhostname.olddomain.tld oldhostname
55
-
56
- # common prefix, but different fqdn
57
- 192.168.12.34 oldhostname.olddomain.tld.different
58
-
59
- # different characters at the dot
60
- 192.168.34.56 oldhostname-olddomain.tld
61
- ETC_HOSTS
62
-
63
- modified_etc_hosts = original_etc_hosts.gsub(search, replace)
64
-
65
- expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
66
- 127.0.0.1 localhost
67
- 127.0.1.1 newhostname.newdomain.tld newhostname
68
-
69
- # common prefix, but different fqdn
70
- 192.168.12.34 oldhostname.olddomain.tld.different
71
-
72
- # different characters at the dot
73
- 192.168.34.56 oldhostname-olddomain.tld
74
- RESULT
75
- end
76
-
77
- it "appends 127.0.1.1 if it isn't there" do
78
- communicator.stub_command(grep_command, exit_code: 1)
79
- described_class.change_host_name(machine, 'newhostname.newdomain.tld')
80
-
81
- sed = communicator.received_commands.find { |cmd| cmd =~ /^sed/ }
82
- expect(sed).to be_nil
83
-
84
- echo = communicator.received_commands.find { |cmd| cmd =~ /^echo/ }
85
- expect(echo).to_not be_nil
86
- end
87
-
88
- context "when the old fqdn has a trailing dot" do
89
- let(:old_hostname) { 'oldhostname.withtrailing.dot.' }
90
-
91
- it "modifies /etc/hosts properly" do
92
- original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
93
- 127.0.0.1 localhost
94
- 127.0.1.1 oldhostname.withtrailing.dot. oldhostname
95
- ETC_HOSTS
96
-
97
- modified_etc_hosts = original_etc_hosts.gsub(search, replace)
98
-
99
- expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
100
- 127.0.0.1 localhost
101
- 127.0.1.1 newhostname.newdomain.tld newhostname
102
- RESULT
103
- end
104
- end
105
- end
106
- end
@@ -1,252 +0,0 @@
1
- shared_examples 'a partial redhat-like host name change' do
2
- shared_examples 'shared between newhostname styles' do
3
-
4
- it 'sets dhcp_hostname with the provided short hostname' do
5
- communicator.expect_command(%q(sed -i 's/\\(DHCP_HOSTNAME=\\).*/\\1"newhostname"/' /etc/sysconfig/network-scripts/ifcfg-*))
6
- described_class.change_host_name(machine, new_hostname)
7
- end
8
-
9
- it 'restarts networking' do
10
- communicator.expect_command(%q(service network restart))
11
- described_class.change_host_name(machine, new_hostname)
12
- end
13
- end
14
-
15
- context 'when newhostname is qualified' do
16
- let(:new_hostname) {'newhostname.newdomain.tld'}
17
-
18
- include_examples 'shared between newhostname styles'
19
-
20
- it 'updates sysconfig with the provided full hostname' do
21
- communicator.expect_command(%q(sed -i 's/\\(HOSTNAME=\\).*/\\1newhostname.newdomain.tld/' /etc/sysconfig/network))
22
- described_class.change_host_name(machine, new_hostname)
23
- end
24
-
25
- it 'updates hostname on the machine with the new hostname' do
26
- communicator.expect_command(%q(hostname newhostname.newdomain.tld))
27
- described_class.change_host_name(machine, new_hostname)
28
- end
29
- end
30
-
31
- context 'when newhostname is simple' do
32
- let(:new_hostname) {'newhostname'}
33
-
34
- include_examples 'shared between newhostname styles'
35
-
36
- it 'updates sysconfig with as much hostname as is available' do
37
- communicator.expect_command(%q(sed -i 's/\\(HOSTNAME=\\).*/\\1newhostname/' /etc/sysconfig/network))
38
- described_class.change_host_name(machine, new_hostname)
39
- end
40
-
41
- it 'updates hostname on the machine with the new hostname' do
42
- communicator.expect_command(%q(hostname newhostname))
43
- described_class.change_host_name(machine, new_hostname)
44
- end
45
-
46
- end
47
- end
48
-
49
- shared_examples 'a full redhat-like host name change' do
50
- include_examples 'a partial redhat-like host name change'
51
-
52
- it "does nothing when the provided hostname is not different" do
53
- described_class.change_host_name(machine, old_hostname)
54
- expect(communicator.received_commands.to_set).to eq(communicator.expected_commands.keys.to_set)
55
- end
56
-
57
- it "does more when the provided hostname is a similar version" do
58
- described_class.change_host_name(machine, similar_hostname)
59
- expect(communicator.received_commands.to_set).not_to eq(communicator.expected_commands.keys.to_set)
60
- end
61
- end
62
-
63
- shared_examples 'mutating /etc/hosts helpers' do
64
- let(:sed_command) do
65
- # Here we run the change_host_name through and extract the recorded sed
66
- # command from the dummy communicator
67
- described_class.change_host_name(machine, new_hostname)
68
- communicator.received_commands.find { |cmd| cmd =~ %r(^sed .* /etc/hosts$) }
69
- end
70
-
71
- # Now we extract the regexp from that sed command so we can do some
72
- # verification on it
73
- let(:expression) { sed_command.sub(%r{^sed -i '\(.*\)' /etc/hosts$}, "\1") }
74
- let(:search) { Regexp.new(expression.split('@')[1].gsub(/\\/,'')) }
75
- let(:replace) { expression.split('@')[2] }
76
- end
77
-
78
- shared_examples 'inserting hostname in /etc/hosts' do
79
- include_examples 'mutating /etc/hosts helpers'
80
-
81
- context 'when target hostname is qualified' do
82
- let(:new_hostname) {'newhostname.newdomain.tld'}
83
-
84
- it 'works with a basic file' do
85
- original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
86
- 127.0.0.1 localhost.localdomain localhost
87
- ::1 localhost6.localdomain6 localhost6
88
- ETC_HOSTS
89
-
90
- modified_etc_hosts = original_etc_hosts.gsub(search, replace)
91
-
92
- expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
93
- 127.0.0.1 newhostname.newdomain.tld newhostname localhost.localdomain localhost
94
- ::1 localhost6.localdomain6 localhost6
95
- RESULT
96
- end
97
- end
98
-
99
- context 'when target hostname is simple' do
100
- let(:new_hostname) {'newhostname'}
101
-
102
- it 'works with a basic file' do
103
- original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
104
- 127.0.0.1 localhost.localdomain localhost
105
- ::1 localhost6.localdomain6 localhost6
106
- ETC_HOSTS
107
-
108
- modified_etc_hosts = original_etc_hosts.gsub(search, replace)
109
-
110
- expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
111
- 127.0.0.1 newhostname localhost.localdomain localhost
112
- ::1 localhost6.localdomain6 localhost6
113
- RESULT
114
- end
115
- end
116
- end
117
-
118
- shared_examples 'swapping simple hostname in /etc/hosts' do
119
- include_examples 'mutating /etc/hosts helpers'
120
-
121
- context 'when target hostname is qualified' do
122
- let(:new_hostname) {'newhostname.newdomain.tld'}
123
-
124
- it 'works with a basic file' do
125
- original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
126
- 127.0.0.1 oldhostname localhost.localdomain localhost
127
- ::1 localhost6.localdomain6 localhost6
128
- ETC_HOSTS
129
-
130
- modified_etc_hosts = original_etc_hosts.gsub(search, replace)
131
-
132
- expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
133
- 127.0.0.1 newhostname.newdomain.tld newhostname localhost.localdomain localhost
134
- ::1 localhost6.localdomain6 localhost6
135
- RESULT
136
- end
137
-
138
- it 'does not touch suffixed hosts' do
139
- original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
140
- 127.0.0.1 oldhostname oldhostname.nope localhost.localdomain localhost
141
- ::1 localhost6.localdomain6 localhost6
142
- ETC_HOSTS
143
-
144
- modified_etc_hosts = original_etc_hosts.gsub(search, replace)
145
-
146
- expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
147
- 127.0.0.1 newhostname.newdomain.tld newhostname oldhostname.nope localhost.localdomain localhost
148
- ::1 localhost6.localdomain6 localhost6
149
- RESULT
150
- end
151
- end
152
-
153
- context 'when target hostname is simple' do
154
- let(:new_hostname) {'newhostname'}
155
-
156
- it 'works with a basic file' do
157
- original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
158
- 127.0.0.1 oldhostname localhost.localdomain localhost
159
- ::1 localhost6.localdomain6 localhost6
160
- ETC_HOSTS
161
-
162
- modified_etc_hosts = original_etc_hosts.gsub(search, replace)
163
-
164
- expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
165
- 127.0.0.1 newhostname localhost.localdomain localhost
166
- ::1 localhost6.localdomain6 localhost6
167
- RESULT
168
- end
169
-
170
- it 'does not touch suffixed hosts' do
171
- original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
172
- 127.0.0.1 oldhostname oldhostname.nope localhost.localdomain localhost
173
- ::1 localhost6.localdomain6 localhost6
174
- ETC_HOSTS
175
-
176
- modified_etc_hosts = original_etc_hosts.gsub(search, replace)
177
-
178
- expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
179
- 127.0.0.1 newhostname oldhostname.nope localhost.localdomain localhost
180
- ::1 localhost6.localdomain6 localhost6
181
- RESULT
182
- end
183
- end
184
- end
185
-
186
- shared_examples 'swapping qualified hostname in /etc/hosts' do
187
- include_examples 'mutating /etc/hosts helpers'
188
-
189
- context 'when target hostname is qualified' do
190
- let(:new_hostname) {'newhostname.newdomain.tld'}
191
-
192
- it 'works with a basic file' do
193
- original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
194
- 127.0.0.1 oldhostname.olddomain.tld oldhostname localhost.localdomain localhost
195
- ::1 localhost6.localdomain6 localhost6
196
- ETC_HOSTS
197
-
198
- modified_etc_hosts = original_etc_hosts.gsub(search, replace)
199
-
200
- expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
201
- 127.0.0.1 newhostname.newdomain.tld newhostname localhost.localdomain localhost
202
- ::1 localhost6.localdomain6 localhost6
203
- RESULT
204
- end
205
-
206
- it 'does not touch suffixed hosts' do
207
- original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
208
- 127.0.0.1 oldhostname.olddomain.tld oldhostname oldhostname.nope localhost.localdomain localhost
209
- ::1 localhost6.localdomain6 localhost6
210
- ETC_HOSTS
211
-
212
- modified_etc_hosts = original_etc_hosts.gsub(search, replace)
213
-
214
- expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
215
- 127.0.0.1 newhostname.newdomain.tld newhostname oldhostname.nope localhost.localdomain localhost
216
- ::1 localhost6.localdomain6 localhost6
217
- RESULT
218
- end
219
- end
220
-
221
- context 'when target hostname is simple' do
222
- let(:new_hostname) {'newhostname'}
223
-
224
- it 'works with a basic file' do
225
- original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
226
- 127.0.0.1 oldhostname.olddomain.tld oldhostname localhost.localdomain localhost
227
- ::1 localhost6.localdomain6 localhost6
228
- ETC_HOSTS
229
-
230
- modified_etc_hosts = original_etc_hosts.gsub(search, replace)
231
-
232
- expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
233
- 127.0.0.1 newhostname localhost.localdomain localhost
234
- ::1 localhost6.localdomain6 localhost6
235
- RESULT
236
- end
237
-
238
- it 'does not touch suffixed hosts' do
239
- original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
240
- 127.0.0.1 oldhostname.olddomain.tld oldhostname oldhostname.nope localhost.localdomain localhost
241
- ::1 localhost6.localdomain6 localhost6
242
- ETC_HOSTS
243
-
244
- modified_etc_hosts = original_etc_hosts.gsub(search, replace)
245
-
246
- expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
247
- 127.0.0.1 newhostname oldhostname.nope localhost.localdomain localhost
248
- ::1 localhost6.localdomain6 localhost6
249
- RESULT
250
- end
251
- end
252
- end
@@ -1,224 +0,0 @@
1
- require_relative "../../../base"
2
- require_relative "../support/shared/config"
3
-
4
- require "vagrant/util/platform"
5
-
6
- require Vagrant.source_root.join("plugins/provisioners/ansible/config/host")
7
-
8
- describe VagrantPlugins::Ansible::Config::Host do
9
- include_context "unit"
10
-
11
- subject { described_class.new }
12
-
13
- let(:machine) { double("machine", env: Vagrant::Environment.new) }
14
- let(:existing_file) { File.expand_path(__FILE__) }
15
- let(:non_existing_file) do
16
- next "/this/does/not/exist" if !Vagrant::Util::Platform.windows?
17
- "C:/foo/nope/nope"
18
- end
19
-
20
- it "supports a list of options" do
21
- config_options = subject.public_methods(false).find_all { |i| i.to_s.end_with?('=') }
22
- config_options.map! { |i| i.to_s.sub('=', '') }
23
-
24
- supported_options = %w( ask_sudo_pass
25
- ask_vault_pass
26
- extra_vars
27
- force_remote_user
28
- galaxy_command
29
- galaxy_role_file
30
- galaxy_roles_path
31
- groups
32
- host_key_checking
33
- host_vars
34
- inventory_path
35
- limit
36
- playbook
37
- raw_arguments
38
- raw_ssh_args
39
- skip_tags
40
- start_at_task
41
- sudo
42
- sudo_user
43
- tags
44
- vault_password_file
45
- verbose )
46
-
47
- expect(get_provisioner_option_names(described_class)).to eql(supported_options)
48
- end
49
-
50
- it "assigns default values to unset options" do
51
- subject.finalize!
52
-
53
- expect(subject.playbook).to be_nil
54
- expect(subject.extra_vars).to be_nil
55
- expect(subject.force_remote_user).to be_true
56
- expect(subject.ask_sudo_pass).to be_false
57
- expect(subject.ask_vault_pass).to be_false
58
- expect(subject.vault_password_file).to be_nil
59
- expect(subject.limit).to be_nil
60
- expect(subject.sudo).to be_false
61
- expect(subject.sudo_user).to be_nil
62
- expect(subject.verbose).to be_false
63
- expect(subject.tags).to be_nil
64
- expect(subject.skip_tags).to be_nil
65
- expect(subject.start_at_task).to be_nil
66
- expect(subject.host_vars).to eq({})
67
- expect(subject.groups).to eq({})
68
- expect(subject.host_key_checking).to be_false
69
- expect(subject.raw_arguments).to be_nil
70
- expect(subject.raw_ssh_args).to be_nil
71
- end
72
-
73
- describe "force_remote_user option" do
74
- it_behaves_like "any VagrantConfigProvisioner strict boolean attribute", :force_remote_user, true
75
- end
76
- describe "host_key_checking option" do
77
- it_behaves_like "any VagrantConfigProvisioner strict boolean attribute", :host_key_checking, false
78
- end
79
- describe "ask_sudo_pass option" do
80
- it_behaves_like "any VagrantConfigProvisioner strict boolean attribute", :ask_sudo_pass, false
81
- end
82
- describe "ask_vault_pass option" do
83
- it_behaves_like "any VagrantConfigProvisioner strict boolean attribute", :ask_sudo_pass, false
84
- end
85
- describe "sudo option" do
86
- it_behaves_like "any VagrantConfigProvisioner strict boolean attribute", :sudo, false
87
- end
88
-
89
- describe "#validate" do
90
- before do
91
- subject.playbook = existing_file
92
- end
93
-
94
- it "passes if the playbook option refers to an existing file" do
95
- subject.finalize!
96
-
97
- result = subject.validate(machine)
98
- expect(result["ansible remote provisioner"]).to eql([])
99
- end
100
-
101
- it "returns an error if the playbook option is undefined" do
102
- subject.playbook = nil
103
- subject.finalize!
104
-
105
- result = subject.validate(machine)
106
- expect(result["ansible remote provisioner"]).to eql([
107
- I18n.t("vagrant.provisioners.ansible.errors.no_playbook")
108
- ])
109
- end
110
-
111
- it "returns an error if the playbook file does not exist" do
112
- subject.playbook = non_existing_file
113
- subject.finalize!
114
-
115
- result = subject.validate(machine)
116
- expect(result["ansible remote provisioner"]).to eql([
117
- I18n.t("vagrant.provisioners.ansible.errors.playbook_path_invalid",
118
- path: non_existing_file, system: "host")
119
- ])
120
- end
121
-
122
- it "passes if the extra_vars option refers to an existing file" do
123
- subject.extra_vars = existing_file
124
- subject.finalize!
125
-
126
- result = subject.validate(machine)
127
- expect(result["ansible remote provisioner"]).to eql([])
128
- end
129
-
130
- it "passes if the extra_vars option is a hash" do
131
- subject.extra_vars = { var1: 1, var2: "foo" }
132
- subject.finalize!
133
-
134
- result = subject.validate(machine)
135
- expect(result["ansible remote provisioner"]).to eql([])
136
- end
137
-
138
- it "returns an error if the extra_vars option refers to a file that does not exist" do
139
- subject.extra_vars = non_existing_file
140
- subject.finalize!
141
-
142
- result = subject.validate(machine)
143
- expect(result["ansible remote provisioner"]).to eql([
144
- I18n.t("vagrant.provisioners.ansible.errors.extra_vars_invalid",
145
- type: subject.extra_vars.class.to_s,
146
- value: subject.extra_vars.to_s)
147
- ])
148
- end
149
-
150
- it "returns an error if the extra_vars option is of wrong data type" do
151
- subject.extra_vars = ["var1", 3, "var2", 5]
152
- subject.finalize!
153
-
154
- result = subject.validate(machine)
155
- expect(result["ansible remote provisioner"]).to eql([
156
- I18n.t("vagrant.provisioners.ansible.errors.extra_vars_invalid",
157
- type: subject.extra_vars.class.to_s,
158
- value: subject.extra_vars.to_s)
159
- ])
160
- end
161
-
162
- it "passes if inventory_path refers to an existing location" do
163
- subject.inventory_path = existing_file
164
- subject.finalize!
165
-
166
- result = subject.validate(machine)
167
- expect(result["ansible remote provisioner"]).to eql([])
168
- end
169
-
170
- it "returns an error if inventory_path is specified, but does not exist" do
171
- subject.inventory_path = non_existing_file
172
- subject.finalize!
173
-
174
- result = subject.validate(machine)
175
- expect(result["ansible remote provisioner"]).to eql([
176
- I18n.t("vagrant.provisioners.ansible.errors.inventory_path_invalid",
177
- path: non_existing_file, system: "host")
178
- ])
179
- end
180
-
181
- it "returns an error if vault_password_file is specified, but does not exist" do
182
- subject.vault_password_file = non_existing_file
183
- subject.finalize!
184
-
185
- result = subject.validate(machine)
186
- expect(result["ansible remote provisioner"]).to eql([
187
- I18n.t("vagrant.provisioners.ansible.errors.vault_password_file_invalid",
188
- path: non_existing_file, system: "host")
189
- ])
190
- end
191
-
192
- it "returns an error if galaxy_role_file is specified, but does not exist" do
193
- subject.galaxy_role_file = non_existing_file
194
- subject.finalize!
195
-
196
- result = subject.validate(machine)
197
- expect(result["ansible remote provisioner"]).to eql([
198
- I18n.t("vagrant.provisioners.ansible.errors.galaxy_role_file_invalid",
199
- path: non_existing_file, system: "host")
200
- ])
201
- end
202
-
203
- it "it collects and returns all detected errors" do
204
- subject.playbook = non_existing_file
205
- subject.inventory_path = non_existing_file
206
- subject.extra_vars = non_existing_file
207
- subject.finalize!
208
-
209
- result = subject.validate(machine)
210
- expect(result["ansible remote provisioner"]).to include(
211
- I18n.t("vagrant.provisioners.ansible.errors.playbook_path_invalid",
212
- path: non_existing_file, system: "host"))
213
- expect(result["ansible remote provisioner"]).to include(
214
- I18n.t("vagrant.provisioners.ansible.errors.extra_vars_invalid",
215
- type: subject.extra_vars.class.to_s,
216
- value: subject.extra_vars.to_s))
217
- expect(result["ansible remote provisioner"]).to include(
218
- I18n.t("vagrant.provisioners.ansible.errors.inventory_path_invalid",
219
- path: non_existing_file, system: "host"))
220
- end
221
-
222
- end
223
-
224
- end