vagrant-unbundled 2.2.6.1 → 2.2.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (247) hide show
  1. checksums.yaml +4 -4
  2. data/.hashibot.hcl +14 -0
  3. data/CHANGELOG.md +153 -2
  4. data/README.md +5 -7
  5. data/bin/vagrant +23 -0
  6. data/contrib/README.md +1 -0
  7. data/contrib/bash/completion.sh +13 -1
  8. data/contrib/sudoers/linux-suse +2 -2
  9. data/contrib/zsh/_vagrant +736 -0
  10. data/contrib/zsh/generate_zsh_completion.rb +166 -0
  11. data/lib/vagrant.rb +25 -0
  12. data/lib/vagrant/action.rb +8 -0
  13. data/lib/vagrant/action/builder.rb +193 -38
  14. data/lib/vagrant/action/builtin/box_add.rb +15 -7
  15. data/lib/vagrant/action/builtin/box_check_outdated.rb +12 -15
  16. data/lib/vagrant/action/builtin/cleanup_disks.rb +56 -0
  17. data/lib/vagrant/action/builtin/cloud_init_setup.rb +127 -0
  18. data/lib/vagrant/action/builtin/cloud_init_wait.rb +30 -0
  19. data/lib/vagrant/action/builtin/delayed.rb +26 -0
  20. data/lib/vagrant/action/builtin/disk.rb +52 -0
  21. data/lib/vagrant/action/builtin/handle_box.rb +3 -1
  22. data/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb +28 -9
  23. data/lib/vagrant/action/builtin/has_provisioner.rb +36 -0
  24. data/lib/vagrant/action/builtin/mixin_provisioners.rb +20 -1
  25. data/lib/vagrant/action/builtin/mixin_synced_folders.rb +20 -21
  26. data/lib/vagrant/action/builtin/set_hostname.rb +5 -1
  27. data/lib/vagrant/action/builtin/ssh_run.rb +21 -3
  28. data/lib/vagrant/action/builtin/synced_folders.rb +10 -0
  29. data/lib/vagrant/action/builtin/trigger.rb +37 -0
  30. data/lib/vagrant/action/hook.rb +76 -23
  31. data/lib/vagrant/action/runner.rb +11 -26
  32. data/lib/vagrant/action/warden.rb +28 -22
  33. data/lib/vagrant/box.rb +5 -4
  34. data/lib/vagrant/box_metadata.rb +17 -3
  35. data/lib/vagrant/bundler.rb +265 -53
  36. data/lib/vagrant/cli.rb +4 -2
  37. data/lib/vagrant/errors.rb +61 -1
  38. data/lib/vagrant/machine.rb +56 -6
  39. data/lib/vagrant/machine_index.rb +27 -1
  40. data/lib/vagrant/plugin/manager.rb +25 -14
  41. data/lib/vagrant/plugin/v2/command.rb +6 -2
  42. data/lib/vagrant/plugin/v2/components.rb +6 -0
  43. data/lib/vagrant/plugin/v2/manager.rb +67 -0
  44. data/lib/vagrant/plugin/v2/plugin.rb +13 -0
  45. data/lib/vagrant/plugin/v2/synced_folder.rb +50 -0
  46. data/lib/vagrant/plugin/v2/trigger.rb +64 -25
  47. data/lib/vagrant/shared_helpers.rb +28 -0
  48. data/lib/vagrant/ui.rb +51 -5
  49. data/lib/vagrant/util.rb +1 -0
  50. data/lib/vagrant/util/ansi_escape_code_remover.rb +1 -1
  51. data/lib/vagrant/util/caps.rb +48 -0
  52. data/lib/vagrant/util/credential_scrubber.rb +1 -1
  53. data/lib/vagrant/util/curl_helper.rb +8 -5
  54. data/lib/vagrant/util/directory.rb +19 -0
  55. data/lib/vagrant/util/downloader.rb +7 -3
  56. data/lib/vagrant/util/file_checksum.rb +6 -2
  57. data/lib/vagrant/util/guest_hosts.rb +68 -0
  58. data/lib/vagrant/util/guest_inspection.rb +9 -1
  59. data/lib/vagrant/util/install_cli_autocomplete.rb +118 -0
  60. data/lib/vagrant/util/io.rb +7 -27
  61. data/lib/vagrant/util/ipv4_interfaces.rb +15 -0
  62. data/lib/vagrant/util/is_port_open.rb +8 -20
  63. data/lib/vagrant/util/map_command_options.rb +33 -0
  64. data/lib/vagrant/util/network_ip.rb +11 -1
  65. data/lib/vagrant/util/numeric.rb +69 -0
  66. data/lib/vagrant/util/platform.rb +8 -1
  67. data/lib/vagrant/util/powershell.rb +1 -1
  68. data/lib/vagrant/util/subprocess.rb +9 -1
  69. data/lib/vagrant/vagrantfile.rb +1 -1
  70. data/plugins/commands/autocomplete/command/install.rb +49 -0
  71. data/plugins/commands/autocomplete/command/root.rb +64 -0
  72. data/plugins/commands/autocomplete/plugin.rb +18 -0
  73. data/plugins/commands/box/command/outdated.rb +14 -2
  74. data/plugins/commands/cloud/locales/en.yml +1 -1
  75. data/plugins/commands/cloud/publish.rb +1 -1
  76. data/plugins/commands/destroy/command.rb +6 -2
  77. data/plugins/commands/snapshot/command/save.rb +13 -8
  78. data/plugins/commands/ssh_config/command.rb +1 -1
  79. data/plugins/communicators/ssh/communicator.rb +25 -24
  80. data/plugins/communicators/winrm/config.rb +1 -1
  81. data/plugins/communicators/winrm/helper.rb +1 -1
  82. data/plugins/communicators/winrm/shell.rb +1 -1
  83. data/plugins/communicators/winssh/communicator.rb +126 -38
  84. data/plugins/communicators/winssh/config.rb +3 -7
  85. data/plugins/guests/alpine/cap/change_host_name.rb +10 -11
  86. data/plugins/guests/alpine/cap/rsync.rb +1 -1
  87. data/plugins/guests/alpine/plugin.rb +16 -0
  88. data/plugins/guests/alt/cap/change_host_name.rb +40 -53
  89. data/plugins/guests/arch/cap/change_host_name.rb +5 -14
  90. data/plugins/guests/arch/cap/configure_networks.rb +27 -10
  91. data/plugins/guests/atomic/cap/change_host_name.rb +5 -14
  92. data/plugins/guests/centos/cap/flavor.rb +24 -0
  93. data/plugins/guests/centos/guest.rb +9 -0
  94. data/plugins/guests/centos/plugin.rb +20 -0
  95. data/plugins/guests/darwin/cap/change_host_name.rb +10 -6
  96. data/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb +99 -13
  97. data/plugins/guests/darwin/plugin.rb +5 -0
  98. data/plugins/guests/debian/cap/change_host_name.rb +11 -11
  99. data/plugins/guests/debian/cap/configure_networks.rb +14 -6
  100. data/plugins/guests/esxi/cap/public_key.rb +3 -1
  101. data/plugins/guests/freebsd/cap/change_host_name.rb +10 -6
  102. data/plugins/guests/gentoo/cap/change_host_name.rb +14 -22
  103. data/plugins/guests/haiku/cap/rsync.rb +19 -0
  104. data/plugins/guests/haiku/plugin.rb +15 -0
  105. data/plugins/guests/linux/cap/change_host_name.rb +46 -0
  106. data/plugins/guests/linux/cap/halt.rb +9 -1
  107. data/plugins/guests/linux/cap/mount_smb_shared_folder.rb +16 -0
  108. data/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb +4 -11
  109. data/plugins/guests/linux/cap/persist_mount_shared_folder.rb +62 -0
  110. data/plugins/guests/linux/cap/reboot.rb +48 -0
  111. data/plugins/guests/linux/plugin.rb +20 -0
  112. data/plugins/guests/omnios/cap/change_host_name.rb +10 -16
  113. data/plugins/guests/openbsd/cap/change_host_name.rb +10 -6
  114. data/plugins/guests/photon/cap/change_host_name.rb +9 -15
  115. data/plugins/guests/pld/cap/change_host_name.rb +11 -17
  116. data/plugins/guests/redhat/cap/change_host_name.rb +10 -5
  117. data/plugins/guests/redhat/cap/flavor.rb +3 -1
  118. data/plugins/guests/redhat/cap/nfs_client.rb +2 -2
  119. data/plugins/guests/redhat/cap/smb.rb +20 -0
  120. data/plugins/guests/redhat/plugin.rb +5 -0
  121. data/plugins/guests/slackware/cap/change_host_name.rb +11 -17
  122. data/plugins/guests/solaris11/plugin.rb +5 -0
  123. data/plugins/guests/suse/cap/change_host_name.rb +13 -12
  124. data/plugins/guests/windows/cap/public_key.rb +3 -3
  125. data/plugins/guests/windows/cap/reboot.rb +2 -1
  126. data/plugins/hosts/darwin/cap/fs_iso.rb +49 -0
  127. data/plugins/hosts/darwin/cap/nfs.rb +11 -0
  128. data/plugins/hosts/darwin/plugin.rb +15 -0
  129. data/plugins/hosts/linux/cap/fs_iso.rb +49 -0
  130. data/plugins/hosts/linux/cap/nfs.rb +21 -2
  131. data/plugins/hosts/linux/cap/rdp.rb +1 -1
  132. data/plugins/hosts/linux/plugin.rb +10 -0
  133. data/plugins/hosts/windows/cap/fs_iso.rb +48 -0
  134. data/plugins/hosts/windows/cap/rdp.rb +1 -1
  135. data/plugins/hosts/windows/plugin.rb +15 -0
  136. data/plugins/kernel_v2/config/cloud_init.rb +126 -0
  137. data/plugins/kernel_v2/config/disk.rb +221 -0
  138. data/plugins/kernel_v2/config/ssh_connect.rb +24 -0
  139. data/plugins/kernel_v2/config/vm.rb +225 -11
  140. data/plugins/kernel_v2/config/vm_provisioner.rb +17 -3
  141. data/plugins/kernel_v2/config/vm_trigger.rb +6 -5
  142. data/plugins/providers/docker/action.rb +8 -17
  143. data/plugins/providers/docker/action/forwarded_ports.rb +2 -0
  144. data/plugins/providers/docker/action/prepare_forwarded_port_collision_params.rb +61 -0
  145. data/plugins/providers/docker/cap/has_communicator.rb +11 -0
  146. data/plugins/providers/docker/communicator.rb +1 -1
  147. data/plugins/providers/docker/driver.rb +73 -10
  148. data/plugins/providers/docker/errors.rb +4 -0
  149. data/plugins/providers/docker/executor/local.rb +7 -1
  150. data/plugins/providers/docker/plugin.rb +5 -0
  151. data/plugins/providers/hyperv/action.rb +2 -0
  152. data/plugins/providers/hyperv/action/configure.rb +8 -0
  153. data/plugins/providers/hyperv/action/export.rb +4 -2
  154. data/plugins/providers/hyperv/cap/cleanup_disks.rb +54 -0
  155. data/plugins/providers/hyperv/cap/configure_disks.rb +200 -0
  156. data/plugins/providers/hyperv/cap/validate_disk_ext.rb +34 -0
  157. data/plugins/providers/hyperv/config.rb +5 -0
  158. data/plugins/providers/hyperv/driver.rb +90 -9
  159. data/plugins/providers/hyperv/plugin.rb +25 -0
  160. data/plugins/providers/hyperv/scripts/attach_disk_drive.ps1 +28 -0
  161. data/plugins/providers/hyperv/scripts/dismount_vhd.ps1 +13 -0
  162. data/plugins/providers/hyperv/scripts/get_vhd.ps1 +16 -0
  163. data/plugins/providers/hyperv/scripts/get_vm_status.ps1 +1 -1
  164. data/plugins/providers/hyperv/scripts/list_hdds.ps1 +17 -0
  165. data/plugins/providers/hyperv/scripts/new_vhd.ps1 +31 -0
  166. data/plugins/providers/hyperv/scripts/remove_disk_drive.ps1 +25 -0
  167. data/plugins/providers/hyperv/scripts/resize_disk_drive.ps1 +18 -0
  168. data/plugins/providers/hyperv/scripts/set_enhanced_session_transport_type.ps1 +24 -0
  169. data/plugins/providers/hyperv/scripts/set_vm_integration_services.ps1 +3 -3
  170. data/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 +14 -6
  171. data/plugins/providers/virtualbox/action.rb +14 -1
  172. data/plugins/providers/virtualbox/action/clean_machine_folder.rb +10 -1
  173. data/plugins/providers/virtualbox/action/export.rb +4 -2
  174. data/plugins/providers/virtualbox/action/forward_ports.rb +2 -2
  175. data/plugins/providers/virtualbox/action/import.rb +8 -4
  176. data/plugins/providers/virtualbox/action/prepare_clone_snapshot.rb +4 -2
  177. data/plugins/providers/virtualbox/action/snapshot_delete.rb +4 -2
  178. data/plugins/providers/virtualbox/action/snapshot_restore.rb +4 -2
  179. data/plugins/providers/virtualbox/cap/cleanup_disks.rb +85 -0
  180. data/plugins/providers/virtualbox/cap/configure_disks.rb +440 -0
  181. data/plugins/providers/virtualbox/cap/mount_options.rb +35 -0
  182. data/plugins/providers/virtualbox/cap/validate_disk_ext.rb +34 -0
  183. data/plugins/providers/virtualbox/driver/base.rb +15 -0
  184. data/plugins/providers/virtualbox/driver/meta.rb +17 -2
  185. data/plugins/providers/virtualbox/driver/version_5_0.rb +217 -2
  186. data/plugins/providers/virtualbox/driver/version_6_1.rb +39 -0
  187. data/plugins/providers/virtualbox/model/storage_controller.rb +135 -0
  188. data/plugins/providers/virtualbox/model/storage_controller_array.rb +100 -0
  189. data/plugins/providers/virtualbox/plugin.rb +38 -0
  190. data/plugins/providers/virtualbox/synced_folder.rb +1 -0
  191. data/plugins/provisioners/ansible/cap/guest/alpine/ansible_install.rb +44 -0
  192. data/plugins/provisioners/ansible/cap/guest/arch/ansible_install.rb +20 -3
  193. data/plugins/provisioners/ansible/cap/guest/debian/ansible_install.rb +4 -5
  194. data/plugins/provisioners/ansible/cap/guest/fedora/ansible_install.rb +2 -2
  195. data/plugins/provisioners/ansible/cap/guest/freebsd/ansible_install.rb +2 -2
  196. data/plugins/provisioners/ansible/cap/guest/pip/pip.rb +8 -4
  197. data/plugins/provisioners/ansible/cap/guest/redhat/ansible_install.rb +2 -2
  198. data/plugins/provisioners/ansible/cap/guest/suse/ansible_install.rb +2 -1
  199. data/plugins/provisioners/ansible/cap/guest/ubuntu/ansible_install.rb +3 -3
  200. data/plugins/provisioners/ansible/plugin.rb +5 -0
  201. data/plugins/provisioners/ansible/provisioner/base.rb +1 -1
  202. data/plugins/provisioners/container/client.rb +203 -0
  203. data/plugins/provisioners/container/config.rb +83 -0
  204. data/plugins/provisioners/container/installer.rb +13 -0
  205. data/plugins/provisioners/container/plugin.rb +23 -0
  206. data/plugins/provisioners/container/provisioner.rb +28 -0
  207. data/plugins/provisioners/docker/cap/{redhat → centos}/docker_install.rb +10 -7
  208. data/plugins/provisioners/docker/cap/centos/docker_start_service.rb +24 -0
  209. data/plugins/provisioners/docker/client.rb +4 -175
  210. data/plugins/provisioners/docker/config.rb +2 -72
  211. data/plugins/provisioners/docker/installer.rb +3 -5
  212. data/plugins/provisioners/docker/plugin.rb +6 -6
  213. data/plugins/provisioners/docker/provisioner.rb +4 -10
  214. data/plugins/provisioners/podman/cap/centos/podman_install.rb +35 -0
  215. data/plugins/provisioners/podman/cap/linux/podman_installed.rb +13 -0
  216. data/plugins/provisioners/podman/cap/redhat/podman_install.rb +26 -0
  217. data/plugins/provisioners/podman/client.rb +12 -0
  218. data/plugins/provisioners/podman/config.rb +28 -0
  219. data/plugins/provisioners/podman/installer.rb +33 -0
  220. data/plugins/provisioners/podman/plugin.rb +38 -0
  221. data/plugins/provisioners/podman/provisioner.rb +52 -0
  222. data/plugins/provisioners/salt/provisioner.rb +4 -0
  223. data/plugins/provisioners/shell/config.rb +1 -6
  224. data/plugins/provisioners/shell/provisioner.rb +61 -26
  225. data/plugins/synced_folders/nfs/synced_folder.rb +3 -1
  226. data/plugins/synced_folders/smb/cap/default_fstab_modification.rb +11 -0
  227. data/plugins/synced_folders/smb/cap/mount_options.rb +36 -0
  228. data/plugins/synced_folders/smb/plugin.rb +10 -0
  229. data/plugins/synced_folders/smb/synced_folder.rb +2 -2
  230. data/plugins/synced_folders/unix_mount_helpers.rb +14 -0
  231. data/templates/commands/init/Vagrantfile.erb +1 -1
  232. data/templates/guests/arch/{network_dhcp.erb → default_network/network_dhcp.erb} +0 -0
  233. data/templates/guests/arch/{network_static.erb → default_network/network_static.erb} +0 -0
  234. data/templates/guests/arch/{network_static6.erb → default_network/network_static6.erb} +0 -0
  235. data/templates/guests/arch/systemd_networkd/network_dhcp.erb +6 -0
  236. data/templates/guests/arch/systemd_networkd/network_static.erb +9 -0
  237. data/templates/guests/arch/systemd_networkd/network_static6.erb +9 -0
  238. data/templates/guests/linux/etc_fstab.erb +6 -0
  239. data/templates/locales/en.yml +235 -6
  240. data/templates/locales/providers_docker.yml +6 -0
  241. data/templates/nfs/exports_darwin.erb +7 -0
  242. data/vagrant.gemspec +12 -12
  243. data/version.txt +1 -1
  244. metadata +3937 -3686
  245. data/lib/vagrant/action/builtin/after_trigger.rb +0 -31
  246. data/lib/vagrant/action/builtin/before_trigger.rb +0 -28
  247. data/plugins/provisioners/docker/cap/redhat/docker_start_service.rb +0 -16
@@ -0,0 +1,35 @@
1
+ module VagrantPlugins
2
+ module PodmanProvisioner
3
+ module Cap
4
+ module Centos
5
+ module PodmanInstall
6
+ def self.podman_install(machine, kubic)
7
+ if kubic
8
+ # Official install instructions for podman
9
+ # https://podman.io/getting-started/installation.html
10
+ case machine.guest.capability("flavor")
11
+ when :centos_7
12
+ machine.communicate.tap do |comm|
13
+ comm.sudo("curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_7/devel:kubic:libcontainers:stable.repo")
14
+ comm.sudo("yum -q -y install podman")
15
+ end
16
+ when :centos_8
17
+ machine.communicate.tap do |comm|
18
+ comm.sudo("dnf -y module disable container-tools &> /dev/null || echo 'container-tools module does not exist'")
19
+ comm.sudo("dnf -y install 'dnf-command(copr)'")
20
+ comm.sudo("dnf -y copr enable rhcontainerbot/container-selinux")
21
+ comm.sudo("curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_8/devel:kubic:libcontainers:stable.repo")
22
+ comm.sudo("dnf -y install podman")
23
+ end
24
+ end
25
+ else
26
+ machine.communicate.tap do |comm|
27
+ comm.sudo("yum -q -y install podman")
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,13 @@
1
+ module VagrantPlugins
2
+ module PodmanProvisioner
3
+ module Cap
4
+ module Linux
5
+ module PodmanInstalled
6
+ def self.podman_installed(machine)
7
+ machine.communicate.test("command -v podman")
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,26 @@
1
+ module VagrantPlugins
2
+ module PodmanProvisioner
3
+ module Cap
4
+ module Redhat
5
+ module PodmanInstall
6
+ def self.podman_install(machine, kubic)
7
+ # Official install instructions for podman
8
+ # https://podman.io/getting-started/installation.html
9
+ case machine.guest.capability("flavor")
10
+ when :rhel_7
11
+ machine.communicate.tap do |comm|
12
+ comm.sudo("subscription-manager repos --enable=rhel-7-server-extras-rpms")
13
+ comm.sudo("yum -q -y install podman")
14
+ end
15
+ when :rhel_8
16
+ machine.communicate.tap do |comm|
17
+ comm.sudo("yum module enable -y container-tools")
18
+ comm.sudo("yum module install -y container-tools")
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,12 @@
1
+ require_relative "../container/client"
2
+
3
+ module VagrantPlugins
4
+ module PodmanProvisioner
5
+ class Client < VagrantPlugins::ContainerProvisioner::Client
6
+ def initialize(machine)
7
+ super(machine, "podman")
8
+ @container_command = "podman"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,28 @@
1
+ require_relative "../container/config"
2
+
3
+ module VagrantPlugins
4
+ module PodmanProvisioner
5
+ class Config < VagrantPlugins::ContainerProvisioner::Config
6
+ attr_accessor :kubic
7
+
8
+ def initialize
9
+ super()
10
+ @kubic = UNSET_VALUE
11
+ end
12
+
13
+ def finalize!
14
+ super()
15
+ @kubic = false if @kubic == UNSET_VALUE
16
+ end
17
+
18
+ def post_install_provision(name, **options, &block)
19
+ # Abort
20
+ raise PodmanError, :wrong_provisioner if options[:type] == "podman"
21
+
22
+ proxy = VagrantPlugins::Kernel_V2::VMConfig.new
23
+ proxy.provision(name, **options, &block)
24
+ @post_install_provisioner = proxy.provisioners.first
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,33 @@
1
+ require_relative "../container/installer"
2
+
3
+ module VagrantPlugins
4
+ module PodmanProvisioner
5
+ class Installer < VagrantPlugins::ContainerProvisioner::Installer
6
+ # This handles verifying the Podman installation, installing it if it was
7
+ # requested, and so on. This method will raise exceptions if things are
8
+ # wrong.
9
+ # @params [Boolean] - if true install should use kubic project (this will)
10
+ # add a yum repo.
11
+ # if false install comes from default yum
12
+ # @return [Boolean] - false if podman cannot be detected on machine, else
13
+ # true if podman installs correctly or is installed
14
+ def ensure_installed(kubic)
15
+ if !@machine.guest.capability?(:podman_installed)
16
+ @machine.ui.warn("Podman can not be installed")
17
+ return false
18
+ end
19
+
20
+ if !@machine.guest.capability(:podman_installed)
21
+ @machine.ui.detail("Podman installing")
22
+ @machine.guest.capability(:podman_install, kubic)
23
+ end
24
+
25
+ if !@machine.guest.capability(:podman_installed)
26
+ raise PodmanError, :install_failed
27
+ end
28
+
29
+ true
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,38 @@
1
+ require "vagrant"
2
+
3
+ module VagrantPlugins
4
+ module PodmanProvisioner
5
+ class Plugin < Vagrant.plugin("2")
6
+ name "podman"
7
+ description <<-DESC
8
+ Provides support for provisioning your virtual machines with
9
+ OCI images and containers using Podman.
10
+ DESC
11
+
12
+ config(:podman, :provisioner) do
13
+ require_relative "config"
14
+ Config
15
+ end
16
+
17
+ guest_capability("redhat", "podman_install") do
18
+ require_relative "cap/redhat/podman_install"
19
+ Cap::Redhat::PodmanInstall
20
+ end
21
+
22
+ guest_capability("centos", "podman_install") do
23
+ require_relative "cap/centos/podman_install"
24
+ Cap::Centos::PodmanInstall
25
+ end
26
+
27
+ guest_capability("linux", "podman_installed") do
28
+ require_relative "cap/linux/podman_installed"
29
+ Cap::Linux::PodmanInstalled
30
+ end
31
+
32
+ provisioner(:podman) do
33
+ require_relative "provisioner"
34
+ Provisioner
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,52 @@
1
+ require_relative "../container/provisioner"
2
+
3
+ require_relative "installer"
4
+ require_relative "client"
5
+
6
+ module VagrantPlugins
7
+ module PodmanProvisioner
8
+ class PodmanError < Vagrant::Errors::VagrantError
9
+ error_namespace("vagrant.provisioners.podman")
10
+ end
11
+
12
+ class Provisioner < VagrantPlugins::ContainerProvisioner::Provisioner
13
+ def initialize(machine, config, installer = nil, client = nil)
14
+ super(machine, config, installer, client)
15
+
16
+ @installer = installer || Installer.new(@machine)
17
+ @client = client || Client.new(@machine)
18
+ @logger = Log4r::Logger.new("vagrant::provisioners::podman")
19
+ end
20
+
21
+ def provision
22
+ @logger.info("Checking for Podman installation...")
23
+
24
+ if @installer.ensure_installed(config.kubic)
25
+ if !config.post_install_provisioner.nil?
26
+ @logger.info("Running post setup provision script...")
27
+ env = {
28
+ callable: method(:run_provisioner),
29
+ provisioner: config.post_install_provisioner,
30
+ machine: machine}
31
+ machine.env.hook(:run_provisioner, env)
32
+ end
33
+ end
34
+
35
+ if config.images.any?
36
+ @machine.ui.info(I18n.t("vagrant.docker_pulling_images"))
37
+ @client.pull_images(*config.images)
38
+ end
39
+
40
+ if config.build_images.any?
41
+ @machine.ui.info(I18n.t("vagrant.docker_building_images"))
42
+ @client.build_images(config.build_images)
43
+ end
44
+
45
+ if config.containers.any?
46
+ @machine.ui.info(I18n.t("vagrant.docker_starting_containers"))
47
+ @client.run(config.containers)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -158,6 +158,10 @@ module VagrantPlugins
158
158
  options = "%s -N" % options
159
159
  end
160
160
 
161
+ if @config.python_version && @machine.config.vm.communicator != :winrm
162
+ options = "%s -x python%s" % [options, @config.python_version]
163
+ end
164
+
161
165
  if @config.install_type && @machine.config.vm.communicator != :winrm
162
166
  options = "%s %s" % [options, @config.install_type]
163
167
  end
@@ -55,7 +55,7 @@ module VagrantPlugins
55
55
  @sha384 = nil if @sha384 == UNSET_VALUE
56
56
  @sha512 = nil if @sha512 == UNSET_VALUE
57
57
  @env = {} if @env == UNSET_VALUE
58
- @upload_path = "/tmp/vagrant-shell" if @upload_path == UNSET_VALUE
58
+ @upload_path = nil if @upload_path == UNSET_VALUE
59
59
  @privileged = true if @privileged == UNSET_VALUE
60
60
  @binary = false if @binary == UNSET_VALUE
61
61
  @keep_color = false if @keep_color == UNSET_VALUE
@@ -109,11 +109,6 @@ module VagrantPlugins
109
109
  errors << I18n.t("vagrant.provisioners.shell.env_must_be_a_hash")
110
110
  end
111
111
 
112
- # There needs to be a path to upload the script to
113
- if !upload_path
114
- errors << I18n.t("vagrant.provisioners.shell.upload_path_not_set")
115
- end
116
-
117
112
  if !args_valid?
118
113
  errors << I18n.t("vagrant.provisioners.shell.args_bad_type")
119
114
  end
@@ -9,6 +9,10 @@ module VagrantPlugins
9
9
  class Provisioner < Vagrant.plugin("2", :provisioner)
10
10
  include Vagrant::Util::Retryable
11
11
 
12
+ DEFAULT_WINDOWS_SHELL_EXT = ".ps1".freeze
13
+
14
+ CMD_WINDOWS_SHELL_EXT = ".bat".freeze
15
+
12
16
  def provision
13
17
  args = ""
14
18
  if config.args.is_a?(String)
@@ -38,6 +42,27 @@ module VagrantPlugins
38
42
  end
39
43
  end
40
44
 
45
+ def upload_path
46
+ if !defined?(@_upload_path)
47
+ case @machine.config.vm.guest
48
+ when :windows
49
+ @_upload_path = Vagrant::Util::Platform.unix_windows_path(config.upload_path.to_s)
50
+ else
51
+ @_upload_path = config.upload_path.to_s
52
+ end
53
+
54
+ if @_upload_path.empty?
55
+ case @machine.config.vm.guest
56
+ when :windows
57
+ @_upload_path = "C:/tmp/vagrant-shell"
58
+ else
59
+ @_upload_path = "/tmp/vagrant-shell"
60
+ end
61
+ end
62
+ end
63
+ @_upload_path
64
+ end
65
+
41
66
  protected
42
67
 
43
68
  # This handles outputting the communication data back to the UI
@@ -63,10 +88,10 @@ module VagrantPlugins
63
88
  env = config.env.map { |k,v| "#{k}=#{quote_and_escape(v.to_s)}" }
64
89
  env = env.join(" ")
65
90
 
66
- command = "chmod +x '#{config.upload_path}'"
91
+ command = "chmod +x '#{upload_path}'"
67
92
  command << " &&"
68
93
  command << " #{env}" if !env.empty?
69
- command << " #{config.upload_path}#{args}"
94
+ command << " #{upload_path}#{args}"
70
95
 
71
96
  with_script_file do |path|
72
97
  # Upload the script to the machine
@@ -79,10 +104,10 @@ module VagrantPlugins
79
104
  end
80
105
 
81
106
  user = info[:username]
82
- comm.sudo("chown -R #{user} #{config.upload_path}",
107
+ comm.sudo("chown -R #{user} #{upload_path}",
83
108
  error_check: false)
84
109
 
85
- comm.upload(path.to_s, config.upload_path)
110
+ comm.upload(path.to_s, upload_path)
86
111
 
87
112
  if config.name
88
113
  @machine.ui.detail(I18n.t("vagrant.provisioners.shell.running",
@@ -113,22 +138,21 @@ module VagrantPlugins
113
138
  with_script_file do |path|
114
139
  # Upload the script to the machine
115
140
  @machine.communicate.tap do |comm|
116
- env = config.env.map{|k,v| comm.generate_environment_export(k, v)}.join
117
- upload_path = config.upload_path.to_s
118
- if File.extname(upload_path).empty?
119
- remote_ext = @machine.config.winssh.shell == "powershell" ? "ps1" : "bat"
120
- upload_path << ".#{remote_ext}"
121
- end
122
- if remote_ext == "ps1"
141
+ env = config.env.map{|k,v| comm.generate_environment_export(k, v)}.join(';')
142
+
143
+ remote_ext = get_windows_ext(path)
144
+ remote_path = add_extension(upload_path, remote_ext)
145
+
146
+ if remote_ext == ".bat"
147
+ command = "#{env}\n cmd.exe /c \"#{remote_path}\" #{args}"
148
+ else
123
149
  # Copy powershell_args from configuration
124
150
  shell_args = config.powershell_args
125
151
  # For PowerShell scripts bypass the execution policy unless already specified
126
152
  shell_args += " -ExecutionPolicy Bypass" if config.powershell_args !~ /[-\/]ExecutionPolicy/i
127
153
  # CLIXML output is kinda useless, especially on non-windows hosts
128
154
  shell_args += " -OutputFormat Text" if config.powershell_args !~ /[-\/]OutputFormat/i
129
- command = "#{env}\npowershell #{shell_args} #{upload_path}#{args}"
130
- else
131
- command = "#{env}\n#{upload_path}#{args}"
155
+ command = "#{env}\npowershell #{shell_args} -file \"#{remote_path}\"#{args}"
132
156
  end
133
157
 
134
158
  # Reset upload path permissions for the current ssh user
@@ -137,8 +161,8 @@ module VagrantPlugins
137
161
  info = @machine.ssh_info
138
162
  raise Vagrant::Errors::SSHNotReady if info.nil?
139
163
  end
140
-
141
- comm.upload(path.to_s, upload_path)
164
+
165
+ comm.upload(path.to_s, remote_path)
142
166
 
143
167
  if config.name
144
168
  @machine.ui.detail(I18n.t("vagrant.provisioners.shell.running",
@@ -154,7 +178,7 @@ module VagrantPlugins
154
178
  # Execute it with sudo
155
179
  comm.execute(
156
180
  command,
157
- sudo: config.privileged,
181
+ shell: :powershell,
158
182
  error_key: :ssh_bad_exit_status_muted
159
183
  ) do |type, data|
160
184
  handle_comm(type, data)
@@ -174,20 +198,17 @@ module VagrantPlugins
174
198
  @machine.communicate.tap do |comm|
175
199
  # Make sure that the upload path has an extension, since
176
200
  # having an extension is critical for Windows execution
177
- upload_path = config.upload_path.to_s
178
- if File.extname(upload_path) == ""
179
- upload_path += File.extname(path.to_s)
180
- end
201
+ winrm_upload_path = add_extension(upload_path, get_windows_ext(path))
181
202
 
182
203
  # Upload it
183
- comm.upload(path.to_s, upload_path)
204
+ comm.upload(path.to_s, winrm_upload_path)
184
205
 
185
206
  # Build the environment
186
207
  env = config.env.map { |k,v| "$env:#{k} = #{quote_and_escape(v.to_s)}" }
187
208
  env = env.join("; ")
188
209
 
189
210
  # Calculate the path that we'll be executing
190
- exec_path = upload_path
211
+ exec_path = winrm_upload_path
191
212
  exec_path.gsub!('/', '\\')
192
213
  exec_path = "c:#{exec_path}" if exec_path.start_with?("\\")
193
214
 
@@ -236,6 +257,22 @@ module VagrantPlugins
236
257
  "#{quote}#{text.gsub(/#{quote}/) { |m| "#{m}\\#{m}#{m}" }}#{quote}"
237
258
  end
238
259
 
260
+ def add_extension(path, ext)
261
+ return path if !File.extname(path.to_s).empty?
262
+ path + ext
263
+ end
264
+
265
+ def get_windows_ext(path)
266
+ remote_ext = File.extname(upload_path.to_s)
267
+ if remote_ext.empty?
268
+ remote_ext = File.extname(path.to_s)
269
+ if remote_ext.empty?
270
+ remote_ext = @machine.config.winssh.shell == "cmd" ? CMD_WINDOWS_SHELL_EXT : DEFAULT_WINDOWS_SHELL_EXT
271
+ end
272
+ end
273
+ remote_ext
274
+ end
275
+
239
276
  # This method yields the path to a script to upload and execute
240
277
  # on the remote server. This method will properly clean up the
241
278
  # script file if needed.
@@ -269,14 +306,12 @@ module VagrantPlugins
269
306
  ext = File.extname(config.path)
270
307
  script = Pathname.new(config.path).expand_path(root_path).read
271
308
  else
272
- # The script is just the inline code...
273
- ext = ".ps1"
274
309
  script = config.inline
275
310
  end
276
311
 
277
312
  # Replace Windows line endings with Unix ones unless binary file
278
313
  # or we're running on Windows.
279
- if !config.binary && @machine.config.vm.communicator != :winrm
314
+ if !config.binary && @machine.config.vm.guest != :windows
280
315
  begin
281
316
  script = script.gsub(/\r\n?$/, "\n")
282
317
  rescue ArgumentError