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.
- checksums.yaml +4 -4
- data/.hashibot.hcl +14 -0
- data/CHANGELOG.md +153 -2
- data/README.md +5 -7
- data/bin/vagrant +23 -0
- data/contrib/README.md +1 -0
- data/contrib/bash/completion.sh +13 -1
- data/contrib/sudoers/linux-suse +2 -2
- data/contrib/zsh/_vagrant +736 -0
- data/contrib/zsh/generate_zsh_completion.rb +166 -0
- data/lib/vagrant.rb +25 -0
- data/lib/vagrant/action.rb +8 -0
- data/lib/vagrant/action/builder.rb +193 -38
- data/lib/vagrant/action/builtin/box_add.rb +15 -7
- data/lib/vagrant/action/builtin/box_check_outdated.rb +12 -15
- data/lib/vagrant/action/builtin/cleanup_disks.rb +56 -0
- data/lib/vagrant/action/builtin/cloud_init_setup.rb +127 -0
- data/lib/vagrant/action/builtin/cloud_init_wait.rb +30 -0
- data/lib/vagrant/action/builtin/delayed.rb +26 -0
- data/lib/vagrant/action/builtin/disk.rb +52 -0
- data/lib/vagrant/action/builtin/handle_box.rb +3 -1
- data/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb +28 -9
- data/lib/vagrant/action/builtin/has_provisioner.rb +36 -0
- data/lib/vagrant/action/builtin/mixin_provisioners.rb +20 -1
- data/lib/vagrant/action/builtin/mixin_synced_folders.rb +20 -21
- data/lib/vagrant/action/builtin/set_hostname.rb +5 -1
- data/lib/vagrant/action/builtin/ssh_run.rb +21 -3
- data/lib/vagrant/action/builtin/synced_folders.rb +10 -0
- data/lib/vagrant/action/builtin/trigger.rb +37 -0
- data/lib/vagrant/action/hook.rb +76 -23
- data/lib/vagrant/action/runner.rb +11 -26
- data/lib/vagrant/action/warden.rb +28 -22
- data/lib/vagrant/box.rb +5 -4
- data/lib/vagrant/box_metadata.rb +17 -3
- data/lib/vagrant/bundler.rb +265 -53
- data/lib/vagrant/cli.rb +4 -2
- data/lib/vagrant/errors.rb +61 -1
- data/lib/vagrant/machine.rb +56 -6
- data/lib/vagrant/machine_index.rb +27 -1
- data/lib/vagrant/plugin/manager.rb +25 -14
- data/lib/vagrant/plugin/v2/command.rb +6 -2
- data/lib/vagrant/plugin/v2/components.rb +6 -0
- data/lib/vagrant/plugin/v2/manager.rb +67 -0
- data/lib/vagrant/plugin/v2/plugin.rb +13 -0
- data/lib/vagrant/plugin/v2/synced_folder.rb +50 -0
- data/lib/vagrant/plugin/v2/trigger.rb +64 -25
- data/lib/vagrant/shared_helpers.rb +28 -0
- data/lib/vagrant/ui.rb +51 -5
- data/lib/vagrant/util.rb +1 -0
- data/lib/vagrant/util/ansi_escape_code_remover.rb +1 -1
- data/lib/vagrant/util/caps.rb +48 -0
- data/lib/vagrant/util/credential_scrubber.rb +1 -1
- data/lib/vagrant/util/curl_helper.rb +8 -5
- data/lib/vagrant/util/directory.rb +19 -0
- data/lib/vagrant/util/downloader.rb +7 -3
- data/lib/vagrant/util/file_checksum.rb +6 -2
- data/lib/vagrant/util/guest_hosts.rb +68 -0
- data/lib/vagrant/util/guest_inspection.rb +9 -1
- data/lib/vagrant/util/install_cli_autocomplete.rb +118 -0
- data/lib/vagrant/util/io.rb +7 -27
- data/lib/vagrant/util/ipv4_interfaces.rb +15 -0
- data/lib/vagrant/util/is_port_open.rb +8 -20
- data/lib/vagrant/util/map_command_options.rb +33 -0
- data/lib/vagrant/util/network_ip.rb +11 -1
- data/lib/vagrant/util/numeric.rb +69 -0
- data/lib/vagrant/util/platform.rb +8 -1
- data/lib/vagrant/util/powershell.rb +1 -1
- data/lib/vagrant/util/subprocess.rb +9 -1
- data/lib/vagrant/vagrantfile.rb +1 -1
- data/plugins/commands/autocomplete/command/install.rb +49 -0
- data/plugins/commands/autocomplete/command/root.rb +64 -0
- data/plugins/commands/autocomplete/plugin.rb +18 -0
- data/plugins/commands/box/command/outdated.rb +14 -2
- data/plugins/commands/cloud/locales/en.yml +1 -1
- data/plugins/commands/cloud/publish.rb +1 -1
- data/plugins/commands/destroy/command.rb +6 -2
- data/plugins/commands/snapshot/command/save.rb +13 -8
- data/plugins/commands/ssh_config/command.rb +1 -1
- data/plugins/communicators/ssh/communicator.rb +25 -24
- data/plugins/communicators/winrm/config.rb +1 -1
- data/plugins/communicators/winrm/helper.rb +1 -1
- data/plugins/communicators/winrm/shell.rb +1 -1
- data/plugins/communicators/winssh/communicator.rb +126 -38
- data/plugins/communicators/winssh/config.rb +3 -7
- data/plugins/guests/alpine/cap/change_host_name.rb +10 -11
- data/plugins/guests/alpine/cap/rsync.rb +1 -1
- data/plugins/guests/alpine/plugin.rb +16 -0
- data/plugins/guests/alt/cap/change_host_name.rb +40 -53
- data/plugins/guests/arch/cap/change_host_name.rb +5 -14
- data/plugins/guests/arch/cap/configure_networks.rb +27 -10
- data/plugins/guests/atomic/cap/change_host_name.rb +5 -14
- data/plugins/guests/centos/cap/flavor.rb +24 -0
- data/plugins/guests/centos/guest.rb +9 -0
- data/plugins/guests/centos/plugin.rb +20 -0
- data/plugins/guests/darwin/cap/change_host_name.rb +10 -6
- data/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb +99 -13
- data/plugins/guests/darwin/plugin.rb +5 -0
- data/plugins/guests/debian/cap/change_host_name.rb +11 -11
- data/plugins/guests/debian/cap/configure_networks.rb +14 -6
- data/plugins/guests/esxi/cap/public_key.rb +3 -1
- data/plugins/guests/freebsd/cap/change_host_name.rb +10 -6
- data/plugins/guests/gentoo/cap/change_host_name.rb +14 -22
- data/plugins/guests/haiku/cap/rsync.rb +19 -0
- data/plugins/guests/haiku/plugin.rb +15 -0
- data/plugins/guests/linux/cap/change_host_name.rb +46 -0
- data/plugins/guests/linux/cap/halt.rb +9 -1
- data/plugins/guests/linux/cap/mount_smb_shared_folder.rb +16 -0
- data/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb +4 -11
- data/plugins/guests/linux/cap/persist_mount_shared_folder.rb +62 -0
- data/plugins/guests/linux/cap/reboot.rb +48 -0
- data/plugins/guests/linux/plugin.rb +20 -0
- data/plugins/guests/omnios/cap/change_host_name.rb +10 -16
- data/plugins/guests/openbsd/cap/change_host_name.rb +10 -6
- data/plugins/guests/photon/cap/change_host_name.rb +9 -15
- data/plugins/guests/pld/cap/change_host_name.rb +11 -17
- data/plugins/guests/redhat/cap/change_host_name.rb +10 -5
- data/plugins/guests/redhat/cap/flavor.rb +3 -1
- data/plugins/guests/redhat/cap/nfs_client.rb +2 -2
- data/plugins/guests/redhat/cap/smb.rb +20 -0
- data/plugins/guests/redhat/plugin.rb +5 -0
- data/plugins/guests/slackware/cap/change_host_name.rb +11 -17
- data/plugins/guests/solaris11/plugin.rb +5 -0
- data/plugins/guests/suse/cap/change_host_name.rb +13 -12
- data/plugins/guests/windows/cap/public_key.rb +3 -3
- data/plugins/guests/windows/cap/reboot.rb +2 -1
- data/plugins/hosts/darwin/cap/fs_iso.rb +49 -0
- data/plugins/hosts/darwin/cap/nfs.rb +11 -0
- data/plugins/hosts/darwin/plugin.rb +15 -0
- data/plugins/hosts/linux/cap/fs_iso.rb +49 -0
- data/plugins/hosts/linux/cap/nfs.rb +21 -2
- data/plugins/hosts/linux/cap/rdp.rb +1 -1
- data/plugins/hosts/linux/plugin.rb +10 -0
- data/plugins/hosts/windows/cap/fs_iso.rb +48 -0
- data/plugins/hosts/windows/cap/rdp.rb +1 -1
- data/plugins/hosts/windows/plugin.rb +15 -0
- data/plugins/kernel_v2/config/cloud_init.rb +126 -0
- data/plugins/kernel_v2/config/disk.rb +221 -0
- data/plugins/kernel_v2/config/ssh_connect.rb +24 -0
- data/plugins/kernel_v2/config/vm.rb +225 -11
- data/plugins/kernel_v2/config/vm_provisioner.rb +17 -3
- data/plugins/kernel_v2/config/vm_trigger.rb +6 -5
- data/plugins/providers/docker/action.rb +8 -17
- data/plugins/providers/docker/action/forwarded_ports.rb +2 -0
- data/plugins/providers/docker/action/prepare_forwarded_port_collision_params.rb +61 -0
- data/plugins/providers/docker/cap/has_communicator.rb +11 -0
- data/plugins/providers/docker/communicator.rb +1 -1
- data/plugins/providers/docker/driver.rb +73 -10
- data/plugins/providers/docker/errors.rb +4 -0
- data/plugins/providers/docker/executor/local.rb +7 -1
- data/plugins/providers/docker/plugin.rb +5 -0
- data/plugins/providers/hyperv/action.rb +2 -0
- data/plugins/providers/hyperv/action/configure.rb +8 -0
- data/plugins/providers/hyperv/action/export.rb +4 -2
- data/plugins/providers/hyperv/cap/cleanup_disks.rb +54 -0
- data/plugins/providers/hyperv/cap/configure_disks.rb +200 -0
- data/plugins/providers/hyperv/cap/validate_disk_ext.rb +34 -0
- data/plugins/providers/hyperv/config.rb +5 -0
- data/plugins/providers/hyperv/driver.rb +90 -9
- data/plugins/providers/hyperv/plugin.rb +25 -0
- data/plugins/providers/hyperv/scripts/attach_disk_drive.ps1 +28 -0
- data/plugins/providers/hyperv/scripts/dismount_vhd.ps1 +13 -0
- data/plugins/providers/hyperv/scripts/get_vhd.ps1 +16 -0
- data/plugins/providers/hyperv/scripts/get_vm_status.ps1 +1 -1
- data/plugins/providers/hyperv/scripts/list_hdds.ps1 +17 -0
- data/plugins/providers/hyperv/scripts/new_vhd.ps1 +31 -0
- data/plugins/providers/hyperv/scripts/remove_disk_drive.ps1 +25 -0
- data/plugins/providers/hyperv/scripts/resize_disk_drive.ps1 +18 -0
- data/plugins/providers/hyperv/scripts/set_enhanced_session_transport_type.ps1 +24 -0
- data/plugins/providers/hyperv/scripts/set_vm_integration_services.ps1 +3 -3
- data/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 +14 -6
- data/plugins/providers/virtualbox/action.rb +14 -1
- data/plugins/providers/virtualbox/action/clean_machine_folder.rb +10 -1
- data/plugins/providers/virtualbox/action/export.rb +4 -2
- data/plugins/providers/virtualbox/action/forward_ports.rb +2 -2
- data/plugins/providers/virtualbox/action/import.rb +8 -4
- data/plugins/providers/virtualbox/action/prepare_clone_snapshot.rb +4 -2
- data/plugins/providers/virtualbox/action/snapshot_delete.rb +4 -2
- data/plugins/providers/virtualbox/action/snapshot_restore.rb +4 -2
- data/plugins/providers/virtualbox/cap/cleanup_disks.rb +85 -0
- data/plugins/providers/virtualbox/cap/configure_disks.rb +440 -0
- data/plugins/providers/virtualbox/cap/mount_options.rb +35 -0
- data/plugins/providers/virtualbox/cap/validate_disk_ext.rb +34 -0
- data/plugins/providers/virtualbox/driver/base.rb +15 -0
- data/plugins/providers/virtualbox/driver/meta.rb +17 -2
- data/plugins/providers/virtualbox/driver/version_5_0.rb +217 -2
- data/plugins/providers/virtualbox/driver/version_6_1.rb +39 -0
- data/plugins/providers/virtualbox/model/storage_controller.rb +135 -0
- data/plugins/providers/virtualbox/model/storage_controller_array.rb +100 -0
- data/plugins/providers/virtualbox/plugin.rb +38 -0
- data/plugins/providers/virtualbox/synced_folder.rb +1 -0
- data/plugins/provisioners/ansible/cap/guest/alpine/ansible_install.rb +44 -0
- data/plugins/provisioners/ansible/cap/guest/arch/ansible_install.rb +20 -3
- data/plugins/provisioners/ansible/cap/guest/debian/ansible_install.rb +4 -5
- data/plugins/provisioners/ansible/cap/guest/fedora/ansible_install.rb +2 -2
- data/plugins/provisioners/ansible/cap/guest/freebsd/ansible_install.rb +2 -2
- data/plugins/provisioners/ansible/cap/guest/pip/pip.rb +8 -4
- data/plugins/provisioners/ansible/cap/guest/redhat/ansible_install.rb +2 -2
- data/plugins/provisioners/ansible/cap/guest/suse/ansible_install.rb +2 -1
- data/plugins/provisioners/ansible/cap/guest/ubuntu/ansible_install.rb +3 -3
- data/plugins/provisioners/ansible/plugin.rb +5 -0
- data/plugins/provisioners/ansible/provisioner/base.rb +1 -1
- data/plugins/provisioners/container/client.rb +203 -0
- data/plugins/provisioners/container/config.rb +83 -0
- data/plugins/provisioners/container/installer.rb +13 -0
- data/plugins/provisioners/container/plugin.rb +23 -0
- data/plugins/provisioners/container/provisioner.rb +28 -0
- data/plugins/provisioners/docker/cap/{redhat → centos}/docker_install.rb +10 -7
- data/plugins/provisioners/docker/cap/centos/docker_start_service.rb +24 -0
- data/plugins/provisioners/docker/client.rb +4 -175
- data/plugins/provisioners/docker/config.rb +2 -72
- data/plugins/provisioners/docker/installer.rb +3 -5
- data/plugins/provisioners/docker/plugin.rb +6 -6
- data/plugins/provisioners/docker/provisioner.rb +4 -10
- data/plugins/provisioners/podman/cap/centos/podman_install.rb +35 -0
- data/plugins/provisioners/podman/cap/linux/podman_installed.rb +13 -0
- data/plugins/provisioners/podman/cap/redhat/podman_install.rb +26 -0
- data/plugins/provisioners/podman/client.rb +12 -0
- data/plugins/provisioners/podman/config.rb +28 -0
- data/plugins/provisioners/podman/installer.rb +33 -0
- data/plugins/provisioners/podman/plugin.rb +38 -0
- data/plugins/provisioners/podman/provisioner.rb +52 -0
- data/plugins/provisioners/salt/provisioner.rb +4 -0
- data/plugins/provisioners/shell/config.rb +1 -6
- data/plugins/provisioners/shell/provisioner.rb +61 -26
- data/plugins/synced_folders/nfs/synced_folder.rb +3 -1
- data/plugins/synced_folders/smb/cap/default_fstab_modification.rb +11 -0
- data/plugins/synced_folders/smb/cap/mount_options.rb +36 -0
- data/plugins/synced_folders/smb/plugin.rb +10 -0
- data/plugins/synced_folders/smb/synced_folder.rb +2 -2
- data/plugins/synced_folders/unix_mount_helpers.rb +14 -0
- data/templates/commands/init/Vagrantfile.erb +1 -1
- data/templates/guests/arch/{network_dhcp.erb → default_network/network_dhcp.erb} +0 -0
- data/templates/guests/arch/{network_static.erb → default_network/network_static.erb} +0 -0
- data/templates/guests/arch/{network_static6.erb → default_network/network_static6.erb} +0 -0
- data/templates/guests/arch/systemd_networkd/network_dhcp.erb +6 -0
- data/templates/guests/arch/systemd_networkd/network_static.erb +9 -0
- data/templates/guests/arch/systemd_networkd/network_static6.erb +9 -0
- data/templates/guests/linux/etc_fstab.erb +6 -0
- data/templates/locales/en.yml +235 -6
- data/templates/locales/providers_docker.yml +6 -0
- data/templates/nfs/exports_darwin.erb +7 -0
- data/vagrant.gemspec +12 -12
- data/version.txt +1 -1
- metadata +3937 -3686
- data/lib/vagrant/action/builtin/after_trigger.rb +0 -31
- data/lib/vagrant/action/builtin/before_trigger.rb +0 -28
- 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,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 =
|
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 '#{
|
91
|
+
command = "chmod +x '#{upload_path}'"
|
67
92
|
command << " &&"
|
68
93
|
command << " #{env}" if !env.empty?
|
69
|
-
command << " #{
|
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} #{
|
107
|
+
comm.sudo("chown -R #{user} #{upload_path}",
|
83
108
|
error_check: false)
|
84
109
|
|
85
|
-
comm.upload(path.to_s,
|
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
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
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} #{
|
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,
|
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
|
-
|
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
|
-
|
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,
|
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 =
|
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.
|
314
|
+
if !config.binary && @machine.config.vm.guest != :windows
|
280
315
|
begin
|
281
316
|
script = script.gsub(/\r\n?$/, "\n")
|
282
317
|
rescue ArgumentError
|