vagrant-unbundled 2.2.6.0 → 2.2.9.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 +93 -2
- data/README.md +1 -3
- data/bin/vagrant +23 -0
- data/contrib/bash/completion.sh +13 -1
- data/lib/vagrant.rb +25 -0
- data/lib/vagrant/action.rb +5 -0
- data/lib/vagrant/action/builder.rb +145 -24
- data/lib/vagrant/action/builtin/box_add.rb +11 -4
- 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/delayed.rb +26 -0
- data/lib/vagrant/action/builtin/disk.rb +52 -0
- data/lib/vagrant/action/builtin/handle_box.rb +2 -0
- data/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb +28 -9
- data/lib/vagrant/action/builtin/mixin_provisioners.rb +19 -1
- data/lib/vagrant/action/builtin/ssh_run.rb +21 -3
- data/lib/vagrant/action/builtin/trigger.rb +36 -0
- data/lib/vagrant/action/hook.rb +20 -2
- data/lib/vagrant/action/runner.rb +11 -26
- data/lib/vagrant/action/warden.rb +4 -18
- data/lib/vagrant/box_metadata.rb +17 -3
- data/lib/vagrant/bundler.rb +260 -53
- data/lib/vagrant/cli.rb +4 -2
- data/lib/vagrant/errors.rb +24 -0
- data/lib/vagrant/machine.rb +9 -6
- data/lib/vagrant/plugin/manager.rb +25 -14
- data/lib/vagrant/plugin/v2/command.rb +1 -1
- data/lib/vagrant/plugin/v2/manager.rb +53 -0
- data/lib/vagrant/plugin/v2/plugin.rb +1 -0
- data/lib/vagrant/plugin/v2/trigger.rb +64 -26
- data/lib/vagrant/shared_helpers.rb +28 -0
- data/lib/vagrant/ui.rb +50 -4
- data/lib/vagrant/util.rb +1 -0
- data/lib/vagrant/util/curl_helper.rb +8 -5
- data/lib/vagrant/util/downloader.rb +5 -1
- data/lib/vagrant/util/file_checksum.rb +6 -2
- data/lib/vagrant/util/guest_inspection.rb +9 -1
- data/lib/vagrant/util/io.rb +7 -27
- data/lib/vagrant/util/is_port_open.rb +1 -2
- data/lib/vagrant/util/map_command_options.rb +33 -0
- data/lib/vagrant/util/numeric.rb +69 -0
- data/lib/vagrant/util/platform.rb +8 -1
- 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/snapshot/command/save.rb +13 -8
- data/plugins/commands/ssh_config/command.rb +1 -1
- data/plugins/communicators/ssh/communicator.rb +18 -23
- data/plugins/communicators/winrm/config.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/rsync.rb +1 -1
- data/plugins/guests/alpine/plugin.rb +16 -0
- 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/mount_vmware_shared_folder.rb +99 -13
- data/plugins/guests/darwin/plugin.rb +5 -0
- data/plugins/guests/debian/cap/configure_networks.rb +14 -6
- 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/reboot.rb +48 -0
- data/plugins/guests/linux/plugin.rb +10 -0
- 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/suse/cap/change_host_name.rb +2 -2
- data/plugins/guests/windows/cap/public_key.rb +3 -3
- data/plugins/guests/windows/cap/reboot.rb +2 -1
- data/plugins/hosts/darwin/cap/nfs.rb +11 -0
- data/plugins/hosts/darwin/plugin.rb +5 -0
- data/plugins/hosts/linux/cap/nfs.rb +21 -2
- data/plugins/kernel_v2/config/disk.rb +199 -0
- data/plugins/kernel_v2/config/ssh_connect.rb +24 -0
- data/plugins/kernel_v2/config/vm.rb +109 -4
- data/plugins/kernel_v2/config/vm_provisioner.rb +4 -1
- data/plugins/kernel_v2/config/vm_trigger.rb +2 -5
- data/plugins/providers/docker/driver.rb +38 -10
- data/plugins/providers/docker/errors.rb +4 -0
- data/plugins/providers/docker/executor/local.rb +7 -1
- data/plugins/providers/hyperv/action/export.rb +4 -2
- data/plugins/providers/hyperv/driver.rb +10 -9
- data/plugins/providers/hyperv/scripts/set_vm_integration_services.ps1 +3 -3
- data/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 +6 -6
- data/plugins/providers/virtualbox/action.rb +2 -0
- 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/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 +54 -0
- data/plugins/providers/virtualbox/cap/configure_disks.rb +287 -0
- data/plugins/providers/virtualbox/cap/validate_disk_ext.rb +27 -0
- data/plugins/providers/virtualbox/driver/base.rb +15 -0
- data/plugins/providers/virtualbox/driver/meta.rb +14 -2
- data/plugins/providers/virtualbox/driver/version_5_0.rb +142 -2
- data/plugins/providers/virtualbox/driver/version_6_1.rb +39 -0
- data/plugins/providers/virtualbox/plugin.rb +21 -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 +54 -25
- data/plugins/synced_folders/smb/synced_folder.rb +1 -1
- data/templates/commands/init/Vagrantfile.erb +1 -1
- data/templates/locales/en.yml +123 -4
- data/templates/locales/providers_docker.yml +2 -0
- data/templates/nfs/exports_darwin.erb +7 -0
- data/vagrant.gemspec +8 -9
- data/version.txt +1 -1
- metadata +3731 -3663
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc8998228365e044e5c4dae334de559593ead91cec2b40a2fb4b659068de08ed
|
4
|
+
data.tar.gz: a1c1681b1fcea9ad3079a71ce3a36ff13a950149d997ccb110c95bec92c7a329
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46388919cbbee6ce29ad5a4590ca652736076d1f951d50574ff66babd15acb22829db1e61a4bae7962af5734d27e7fbbc6c8262fc62ac147ac5d0736e560051b
|
7
|
+
data.tar.gz: 6ceff4e11163fe20e30415a9582c34a94b8241603c0807cc9a8cd10209fc9904ce7cd79f6ae66a2e238d179d90aef071b894792e649d8223f327b511d2c735f3
|
data/.hashibot.hcl
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
poll "closed_issue_locker" "locker" {
|
2
|
+
schedule = "0 50 1 * * *"
|
3
|
+
closed_for = "720h" # 30 days
|
4
|
+
max_issues = 500
|
5
|
+
sleep_between_issues = "5s"
|
6
|
+
|
7
|
+
no_comment_if_no_activity_for = "4320h" # 180 days
|
8
|
+
|
9
|
+
message = <<-EOF
|
10
|
+
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
|
11
|
+
|
12
|
+
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
|
13
|
+
EOF
|
14
|
+
}
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,94 @@
|
|
1
|
+
## 2.2.9 (May 07, 2020)
|
2
|
+
|
3
|
+
BUG FIXES:
|
4
|
+
|
5
|
+
- core/bundler: Properly handle plugin install with available specification [GH-11592]
|
6
|
+
- provisioners/docker: Fix CentOS docker install and start service capabilities [GH-11581]
|
7
|
+
- provisioners/podman: Seperate RHEL install from CentOS install [GH-11584]
|
8
|
+
|
9
|
+
## 2.2.8 (May 04, 2020)
|
10
|
+
|
11
|
+
FEATURES:
|
12
|
+
|
13
|
+
- virtualbox/disks: Add ability to manage virtual disks for guests [GH-11349]
|
14
|
+
|
15
|
+
IMPROVEMENTS:
|
16
|
+
|
17
|
+
- bin/vagrant: Automatically include global options within commands [GH-11473]
|
18
|
+
- bin/vagrant: Suppress Ruby warnings when not running pre-release version [GH-11446]
|
19
|
+
- communicator/ssh: Add support for configuring SSH connect timeout [GH-11533]
|
20
|
+
- core: Update childprocess gem [GH-11487]
|
21
|
+
- core: Add cli option `--no-tty` [GH-11414]
|
22
|
+
- core: Overhaul call stack modifications implementation for hooks and triggers [GH-11455]
|
23
|
+
- core/bundler: Cache plugin solution sets to speed up startup times [GH-11363]
|
24
|
+
- config/vm: Add`box_download_options` config to specify extra download options for a box [GH-11560]
|
25
|
+
- guest/alpine: Add ansible provisioner guest support [GH-11411]
|
26
|
+
- guest/linux: Update systemd? check to use sudo [GH-11398]
|
27
|
+
- guest/linux: Use systemd if available to halt and reboot system [GH-11407]
|
28
|
+
- guests/linux: Mount smb folders with `mfsymlinks` option by default [GH-11503]
|
29
|
+
- guest/redhat: Add support for SMB [GH-11463]
|
30
|
+
- guest/windows: Rescue all regular exceptions during reboot wait [GH-11428]
|
31
|
+
- providers/docker: Support catching container name when using podman [GH-11356]
|
32
|
+
- provisioners/docker: Support Centos8 [GH-11462]
|
33
|
+
- provisioners/podman: Add Podman as a provisioner [GH-11472]
|
34
|
+
- provisioners/salt: Allow specifying python_version [GH-11436]
|
35
|
+
|
36
|
+
BUG FIXES:
|
37
|
+
|
38
|
+
- communicators/winssh: Fix issues with Windows SSH communicator [GH-11430]
|
39
|
+
- core/bundler: Activate vagrant specification when not active [GH-11445]
|
40
|
+
- core/bundler: Properly resolve sets when Vagrant is in prerelease [GH-11571]
|
41
|
+
- core/downloader: Always set `-q` flag as first option [GH-11366]
|
42
|
+
- core/hooks: Update dynamic action hook implementation to prevent looping [GH-11427]
|
43
|
+
- core/synced_folders: Validate type option if set [GH-11359]
|
44
|
+
- guests/debian: Choose netplan renderer based on network configuration and installed tools [GH-11498]
|
45
|
+
- host/darwin: Quote directories in /etc/exports [GH-11441]
|
46
|
+
- host/linux: Ensure `/etc/exports` does not contain duplicate records [GH-10591]
|
47
|
+
- host/windows: Check all interfaces for port conflict when host_ip: "0.0.0.0" [GH-11454]
|
48
|
+
- providers/docker: Fix issue where Vagrant fails to remove image if it is in use [GH-11355]
|
49
|
+
- providers/docker: Fix issue with getting correct docker image id from build output [GH-11461]
|
50
|
+
- providers/hyperv: Prevent error when identity reference cannot be translated [GH-11425]
|
51
|
+
- provider/hyperv: Use service id for manipulating vm integration services [GH-11499]
|
52
|
+
- providers/virtualbox: Parse `list dhcpservers` output on VirtualBox 6.1 [GH-11404]
|
53
|
+
- providers/virtualbox: Raise an error if guest IP ends in .1 [GH-11500]
|
54
|
+
- provisioners/shell: Ensure windows shell provisioners always get an extension [GH-11517]
|
55
|
+
- util/io: Fix encoding conversion errors [GH-11571]
|
56
|
+
|
57
|
+
## 2.2.7 (January 27, 2020)
|
58
|
+
|
59
|
+
IMPROVEMENTS:
|
60
|
+
|
61
|
+
- guest/opensuse: Check for basename hostname prior to setting hostname [GH-11170]
|
62
|
+
- host/linux: Check for modinfo in /sbin if it's not on PATH [GH-11178]
|
63
|
+
- core: Show guest name in hostname error message [GH-11175]
|
64
|
+
- provisioners/shell: Linux guests now support `reboot` option [GH-11194]
|
65
|
+
- darwin/nfs: Put each NFS export on its own line [GH-11216]
|
66
|
+
- contrib/bash: Add more completion flags to up command [GH-11223]
|
67
|
+
- provider/virtualbox: Add VirtualBox provider support for version 6.1.x [GH-11250]
|
68
|
+
- box/outdated: Allow to force check for box updates and ignore cached check [GH-11231]
|
69
|
+
- guest/alpine: Update apk cache when installing rsync [GH-11220]
|
70
|
+
- provider/virtualbox: Improve error message when machine folder is inaccessible [GH-11239]
|
71
|
+
- provisioner/ansible_local: Add pip install method for arch guests [GH-11265]
|
72
|
+
- communicators/winssh: Use Windows shell for `vagrant ssh -c` [GH-11258]
|
73
|
+
|
74
|
+
BUG FIXES:
|
75
|
+
|
76
|
+
- command/snapshot/save: Fix regression that prevented snapshot of all guests in environment [GH-11152]
|
77
|
+
- core: Update UI to properly retain newlines when adding prefix [GH-11126]
|
78
|
+
- core: Check if box update is available locally [GH-11188]
|
79
|
+
- core: Ensure Vagrant::Errors are loaded in file_checksum util [GH-11183]
|
80
|
+
- cloud/publish: Improve argument handling for missing arguments to command [GH-11184]
|
81
|
+
- core: Get latest version for current provider during outdated check [GH-11192]
|
82
|
+
- linux/nfs: avoid adding extra newlines to /etc/exports [GH-11201]
|
83
|
+
- guest/darwin: Fix VMware synced folders on APFS [GH-11267]
|
84
|
+
- guest/redhat: Ensure `nfs-server` is restarted when installing nfs client [GH-11212]
|
85
|
+
- core: Do not validate checksums if options are empty string [GH-11211]
|
86
|
+
- provider/docker: Enhance docker build method to match against buildkit output [GH-11205]
|
87
|
+
- provisioner/ansible_local: Don't prompt for input when installing Ansible on Ubuntu and Debian [GH-11191]
|
88
|
+
- provisioner/ansible_local: Ensure all guest caps accept all passed in arguments [GH-11265]
|
89
|
+
- host/windows: Fix regression that prevented port collisions from being detected [GH-11244]
|
90
|
+
- core/provisioner: Set top level provisioner name if set in a provisioner config [GH-11295]
|
91
|
+
|
1
92
|
## 2.2.6 (October 14, 2019)
|
2
93
|
|
3
94
|
FEATURES:
|
@@ -13,7 +104,7 @@ IMPROVEMENTS:
|
|
13
104
|
- guest/alt: Improve handling for using network tools when setting hostname [GH-11000]
|
14
105
|
- guest/suse: Add ipv6 network config templates for SUSE based distributions [GH-11013]
|
15
106
|
- guest/windows: Retry on connection timeout errors for the reboot capability [GH-11093]
|
16
|
-
- host/bsd: Use host resolve path capability to modify local paths if
|
107
|
+
- host/bsd: Use host resolve path capability to modify local paths if required [GH-11108]
|
17
108
|
- host/darwin: Add host resolve path capability to provide real paths for firmlinks [GH-11108]
|
18
109
|
- provisioners/chef: Update pkg install flags for chef on FreeBSD guests [GH-11075]
|
19
110
|
- provider/hyperv: Improve error message when VMMS is not running [GH-10978]
|
@@ -509,7 +600,7 @@ BUG FIXES:
|
|
509
600
|
- core: Rescue more exceptions when checking if port is open [GH-8517]
|
510
601
|
- guests/solaris11: Inherit from Solaris guest and keep solaris11 specific methods [GH-9034]
|
511
602
|
- guests/windows: Split out cygwin path helper for msys2/cygwin paths and ensure cygpath exists [GH-8972]
|
512
|
-
- guests/windows: Specify expected shell when executing on guest (fixes
|
603
|
+
- guests/windows: Specify expected shell when executing on guest (fixes einssh communicator usage) [GH-9012]
|
513
604
|
- guests/windows: Include WinSSH Communicator when using insert_public_key [GH-9105]
|
514
605
|
- hosts/windows: Check for vagrant.exe when validating versions within WSL [GH-9107, GH-8962]
|
515
606
|
- providers/docker: Isolate windows check within executor to handle running through VM [GH-8921]
|
data/README.md
CHANGED
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
* Website: [https://www.vagrantup.com/](https://www.vagrantup.com/)
|
4
4
|
* Source: [https://github.com/hashicorp/vagrant](https://github.com/hashicorp/vagrant)
|
5
|
-
* [
|
6
|
-
* Mailing list: [Google Groups](https://groups.google.com/group/vagrant-up)
|
7
|
-
* IRC: #vagrant on freenode.org
|
5
|
+
* HashiCorp Discuss: [https://discuss.hashicorp.com/c/vagrant/24](https://discuss.hashicorp.com/c/vagrant/24)
|
8
6
|
|
9
7
|
Vagrant is a tool for building and distributing development environments.
|
10
8
|
|
data/bin/vagrant
CHANGED
@@ -94,6 +94,23 @@ begin
|
|
94
94
|
# Schedule the cleanup of things
|
95
95
|
at_exit(&Vagrant::Bundler.instance.method(:deinit))
|
96
96
|
|
97
|
+
# If this is not a pre-release disable verbose output
|
98
|
+
if !Vagrant.prerelease?
|
99
|
+
$VERBOSE = nil
|
100
|
+
end
|
101
|
+
|
102
|
+
# Add any option flags defined within this file here
|
103
|
+
# so they are automatically propagated to all commands
|
104
|
+
Vagrant.add_default_cli_options(proc { |o|
|
105
|
+
o.on("--[no-]color", "Enable or disable color output")
|
106
|
+
o.on("--machine-readable", "Enable machine readable output")
|
107
|
+
o.on("-v", "--version", "Display Vagrant version")
|
108
|
+
o.on("--debug", "Enable debug output")
|
109
|
+
o.on("--timestamp", "Enable timestamps on log output")
|
110
|
+
o.on("--debug-timestamp", "Enable debug output with timestamps")
|
111
|
+
o.on("--no-tty", "Enable non-interactive output")
|
112
|
+
})
|
113
|
+
|
97
114
|
# Create a logger right away
|
98
115
|
logger = Log4r::Logger.new("vagrant::bin::vagrant")
|
99
116
|
logger.info("`vagrant` invoked: #{ARGV.inspect}")
|
@@ -130,6 +147,12 @@ begin
|
|
130
147
|
opts[:ui_class] = Vagrant::UI::MachineReadable
|
131
148
|
end
|
132
149
|
|
150
|
+
# Setting to enable/disable showing progress bars
|
151
|
+
if argv.include?("--no-tty")
|
152
|
+
argv.delete("--no-tty")
|
153
|
+
opts[:ui_class] = Vagrant::UI::NonInteractive
|
154
|
+
end
|
155
|
+
|
133
156
|
# Default to colored output
|
134
157
|
opts[:ui_class] ||= Vagrant::UI::Colored
|
135
158
|
|
data/contrib/bash/completion.sh
CHANGED
@@ -75,7 +75,19 @@ _vagrant() {
|
|
75
75
|
then
|
76
76
|
local vm_list=$(find "${vagrant_state_file}/machines" -mindepth 1 -maxdepth 1 -type d -exec basename {} \;)
|
77
77
|
fi
|
78
|
-
local up_commands="
|
78
|
+
local up_commands="\
|
79
|
+
--provision \
|
80
|
+
--no-provision \
|
81
|
+
--provision-with \
|
82
|
+
--destroy-on-error \
|
83
|
+
--no-destroy-on-error \
|
84
|
+
--parallel \
|
85
|
+
--no-parallel
|
86
|
+
--provider \
|
87
|
+
--install-provider \
|
88
|
+
--no-install-provider \
|
89
|
+
-h \
|
90
|
+
--help"
|
79
91
|
COMPREPLY=($(compgen -W "${up_commands} ${vm_list}" -- ${cur}))
|
80
92
|
return 0
|
81
93
|
;;
|
data/lib/vagrant.rb
CHANGED
@@ -9,6 +9,31 @@ class Log4r::BasicFormatter
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
+
|
13
|
+
require "optparse"
|
14
|
+
|
15
|
+
module Vagrant
|
16
|
+
# This is a customized OptionParser for Vagrant plugins. It
|
17
|
+
# will automatically add any default CLI options defined
|
18
|
+
# outside of command implementations to the local option
|
19
|
+
# parser instances in use
|
20
|
+
class OptionParser < ::OptionParser
|
21
|
+
def initialize(*_)
|
22
|
+
super
|
23
|
+
Vagrant.default_cli_options.each do |opt_proc|
|
24
|
+
opt_proc.call(self)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Inject the option parser into the vagrant plugins
|
31
|
+
# module so it is automatically used when defining
|
32
|
+
# command options
|
33
|
+
module VagrantPlugins
|
34
|
+
OptionParser = Vagrant::OptionParser
|
35
|
+
end
|
36
|
+
|
12
37
|
require "vagrant/shared_helpers"
|
13
38
|
require "rubygems"
|
14
39
|
require "vagrant/util"
|
data/lib/vagrant/action.rb
CHANGED
@@ -2,6 +2,7 @@ require 'vagrant/action/builder'
|
|
2
2
|
|
3
3
|
module Vagrant
|
4
4
|
module Action
|
5
|
+
autoload :Hook, 'vagrant/action/hook'
|
5
6
|
autoload :Runner, 'vagrant/action/runner'
|
6
7
|
autoload :Warden, 'vagrant/action/warden'
|
7
8
|
|
@@ -12,9 +13,12 @@ module Vagrant
|
|
12
13
|
autoload :BoxCheckOutdated, "vagrant/action/builtin/box_check_outdated"
|
13
14
|
autoload :BoxRemove, "vagrant/action/builtin/box_remove"
|
14
15
|
autoload :Call, "vagrant/action/builtin/call"
|
16
|
+
autoload :CleanupDisks, "vagrant/action/builtin/cleanup_disks"
|
15
17
|
autoload :Confirm, "vagrant/action/builtin/confirm"
|
16
18
|
autoload :ConfigValidate, "vagrant/action/builtin/config_validate"
|
19
|
+
autoload :Delayed, "vagrant/action/builtin/delayed"
|
17
20
|
autoload :DestroyConfirm, "vagrant/action/builtin/destroy_confirm"
|
21
|
+
autoload :Disk, "vagrant/action/builtin/disk"
|
18
22
|
autoload :EnvSet, "vagrant/action/builtin/env_set"
|
19
23
|
autoload :GracefulHalt, "vagrant/action/builtin/graceful_halt"
|
20
24
|
autoload :HandleBox, "vagrant/action/builtin/handle_box"
|
@@ -32,6 +36,7 @@ module Vagrant
|
|
32
36
|
autoload :SSHRun, "vagrant/action/builtin/ssh_run"
|
33
37
|
autoload :SyncedFolders, "vagrant/action/builtin/synced_folders"
|
34
38
|
autoload :SyncedFolderCleanup, "vagrant/action/builtin/synced_folder_cleanup"
|
39
|
+
autoload :Trigger, "vagrant/action/builtin/trigger"
|
35
40
|
autoload :WaitForCommunicator, "vagrant/action/builtin/wait_for_communicator"
|
36
41
|
end
|
37
42
|
|
@@ -122,6 +122,7 @@ module Vagrant
|
|
122
122
|
# @return [Integer]
|
123
123
|
def index(object)
|
124
124
|
stack.each_with_index do |item, i|
|
125
|
+
return i if item == object
|
125
126
|
return i if item[0] == object
|
126
127
|
return i if item[0].respond_to?(:name) && item[0].name == object
|
127
128
|
end
|
@@ -132,42 +133,162 @@ module Vagrant
|
|
132
133
|
# Converts the builder stack to a runnable action sequence.
|
133
134
|
#
|
134
135
|
# @param [Hash] env The action environment hash
|
135
|
-
# @return [
|
136
|
+
# @return [Warden] A callable object
|
136
137
|
def to_app(env)
|
137
|
-
|
138
|
+
# Start with a duplicate of ourself which can
|
139
|
+
# be modified
|
140
|
+
builder = self.dup
|
138
141
|
|
139
|
-
#
|
140
|
-
|
141
|
-
|
142
|
+
# Apply all dynamic modifications of the stack. This
|
143
|
+
# will generate dynamic hooks for all actions within
|
144
|
+
# the stack, load any triggers for action classes, and
|
145
|
+
# apply them to the builder's stack
|
146
|
+
builder.apply_dynamic_updates(env)
|
142
147
|
|
143
|
-
|
144
|
-
|
148
|
+
# Now that the stack is fully expanded, apply any
|
149
|
+
# action hooks that may be defined so they are on
|
150
|
+
# the outermost locations of the stack
|
151
|
+
builder.apply_action_name(env)
|
145
152
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
153
|
+
# Wrap the middleware stack with the Warden to provide a consistent
|
154
|
+
# and predictable behavior upon exceptions.
|
155
|
+
Warden.new(builder.stack.dup, env)
|
156
|
+
end
|
157
|
+
|
158
|
+
# Find any action hooks or triggers which have been defined
|
159
|
+
# for items within the stack. Update the stack with any
|
160
|
+
# hooks or triggers found.
|
161
|
+
#
|
162
|
+
# @param [Hash] env Call environment
|
163
|
+
# @return [Builder] self
|
164
|
+
def apply_dynamic_updates(env)
|
165
|
+
if Vagrant::Util::Experimental.feature_enabled?("typed_triggers")
|
166
|
+
triggers = env[:triggers]
|
167
|
+
end
|
168
|
+
|
169
|
+
# Use a Hook as a convenient interface for injecting
|
170
|
+
# any applicable trigger actions within the stack
|
171
|
+
machine_name = env[:machine].name if env[:machine]
|
172
|
+
|
173
|
+
# Iterate over all items in the stack and apply new items
|
174
|
+
# into the hook as they are found. Must be sure to dup the
|
175
|
+
# stack here since we are modifying the stack in the loop.
|
176
|
+
stack.dup.each do |item|
|
177
|
+
hook = Hook.new
|
178
|
+
|
179
|
+
action = item.first
|
180
|
+
next if action.is_a?(Proc)
|
181
|
+
|
182
|
+
# Start with adding any action triggers that may be defined
|
183
|
+
if triggers && !triggers.find(action, :before, machine_name, :action).empty?
|
184
|
+
hook.prepend(Vagrant::Action::Builtin::Trigger,
|
185
|
+
action.name, triggers, :before, :action)
|
150
186
|
end
|
151
187
|
|
152
|
-
|
153
|
-
|
154
|
-
|
188
|
+
if triggers && !triggers.find(action, :after, machine_name, :action).empty?
|
189
|
+
hook.append(Vagrant::Action::Builtin::Trigger,
|
190
|
+
action.name, triggers, :after, :action)
|
191
|
+
end
|
192
|
+
|
193
|
+
# Next look for any hook triggers that may be defined against
|
194
|
+
# the dynamically generated action class hooks
|
195
|
+
if triggers && !triggers.find(action, :before, machine_name, :hook).empty?
|
196
|
+
hook.prepend(Vagrant::Action::Builtin::Trigger,
|
197
|
+
action.name, triggers, :before, :hook)
|
198
|
+
end
|
199
|
+
|
200
|
+
if triggers && !triggers.find(action, :after, machine_name, :hook).empty?
|
201
|
+
hook.append(Vagrant::Action::Builtin::Trigger,
|
202
|
+
action.name, triggers, :after, :hook)
|
203
|
+
end
|
155
204
|
|
156
|
-
#
|
157
|
-
|
158
|
-
|
205
|
+
# Finally load any registered hooks for dynamically generated
|
206
|
+
# action class based hooks
|
207
|
+
Vagrant.plugin("2").manager.find_action_hooks(action).each do |hook_proc|
|
208
|
+
hook_proc.call(hook)
|
159
209
|
end
|
160
210
|
|
161
|
-
|
162
|
-
app_stack = builder.stack.dup
|
211
|
+
hook.apply(self, root: item)
|
163
212
|
end
|
164
213
|
|
165
|
-
#
|
166
|
-
|
214
|
+
# Apply the hook to ourself to update the stack
|
215
|
+
self
|
216
|
+
end
|
167
217
|
|
168
|
-
|
169
|
-
|
170
|
-
|
218
|
+
# If action hooks have not already been set, this method
|
219
|
+
# will perform three tasks:
|
220
|
+
# 1. Load any hook triggers defined for the action_name
|
221
|
+
# 2. Load any action_hooks defined from plugins
|
222
|
+
# 3. Load any action triggers based on machine action called (not action classes)
|
223
|
+
#
|
224
|
+
# @param [Hash] env Call environment
|
225
|
+
# @return [Builder]
|
226
|
+
def apply_action_name(env)
|
227
|
+
return self if !env[:action_name]
|
228
|
+
hook = Hook.new
|
229
|
+
machine_name = env[:machine].name if env[:machine]
|
230
|
+
|
231
|
+
# Start with loading any hook triggers if applicable
|
232
|
+
if Vagrant::Util::Experimental.feature_enabled?("typed_triggers") && env[:triggers]
|
233
|
+
if !env[:triggers].find(env[:action_name], :before, machine_name, :hook).empty?
|
234
|
+
hook.prepend(Vagrant::Action::Builtin::Trigger,
|
235
|
+
env[:action_name], env[:triggers], :before, :hook)
|
236
|
+
end
|
237
|
+
if !env[:triggers].find(env[:action_name], :after, machine_name, :hook).empty?
|
238
|
+
hook.append(Vagrant::Action::Builtin::Trigger,
|
239
|
+
env[:action_name], env[:triggers], :after, :hook)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
# Next we load up all the action hooks that plugins may
|
244
|
+
# have defined
|
245
|
+
action_hooks = Vagrant.plugin("2").manager.action_hooks(env[:action_name])
|
246
|
+
action_hooks.each do |hook_proc|
|
247
|
+
hook_proc.call(hook)
|
248
|
+
end
|
249
|
+
|
250
|
+
# Finally load any action triggers defined. The action triggers
|
251
|
+
# are the originally implemented trigger style. They run before
|
252
|
+
# and after specific provider actions (like :up, :halt, etc) and
|
253
|
+
# are different from true action triggers
|
254
|
+
if env[:triggers]
|
255
|
+
if !env[:triggers].find(env[:raw_action_name], :before, machine_name, :action).empty?
|
256
|
+
hook.prepend(Vagrant::Action::Builtin::Trigger,
|
257
|
+
env[:raw_action_name], env[:triggers], :before, :action)
|
258
|
+
end
|
259
|
+
if !env[:triggers].find(env[:raw_action_name], :after, machine_name, :action).empty?
|
260
|
+
# NOTE: These after triggers need to be delayed before running to
|
261
|
+
# allow the rest of the call stack to complete before being
|
262
|
+
# run. The delayed action is prepended to the stack (not appended)
|
263
|
+
# to ensure it is called first, which results in it properly
|
264
|
+
# waiting for everything to finish before itself completing.
|
265
|
+
builder = self.class.build(Vagrant::Action::Builtin::Trigger,
|
266
|
+
env[:raw_action_name], env[:triggers], :after, :action)
|
267
|
+
hook.prepend(Vagrant::Action::Builtin::Delayed, builder)
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
# If the hooks are empty, then there was nothing to apply and
|
272
|
+
# we can just send ourself back
|
273
|
+
return self if hook.empty?
|
274
|
+
|
275
|
+
# These are the options to pass into hook application.
|
276
|
+
options = {}
|
277
|
+
|
278
|
+
# If we already ran through once and did append/prepends,
|
279
|
+
# then don't do it again.
|
280
|
+
if env[:action_hooks_already_ran]
|
281
|
+
options[:no_prepend_or_append] = true
|
282
|
+
end
|
283
|
+
|
284
|
+
# Specify that we already ran, so in the future we don't repeat
|
285
|
+
# the prepend/append hooks.
|
286
|
+
env[:action_hooks_already_ran] = true
|
287
|
+
|
288
|
+
# Apply all the hooks to the new builder instance
|
289
|
+
hook.apply(self, options)
|
290
|
+
|
291
|
+
self
|
171
292
|
end
|
172
293
|
end
|
173
294
|
end
|