Commit Graph

3653 Commits

Author SHA1 Message Date
Chris Roberts 798fb81926 Force command to be re-run after installing local plugins
Reloading the Vagrantfile causes issue with multiple evaluations
where users expect single evaluation. Instead of allowing local
plugin installation to happen prior to command execution, force
halt after installation and the command to be re-run. This will
prevent multiple loads of the Vagrantfile within a single run.
2018-09-10 09:59:58 -07:00
Maxim Kostrikin d06cd2f94b
Hardened proc disallow systemd detection
If you have a vagrant box with proc mounted with
proc    /proc    proc    defaults,hidepid=2     0     0
ps output will be limited to owned process
sudo should extend output
2018-09-10 18:13:58 +07:00
Robert Schulze 28771674d6 add `Vagrant.version?` helper method
to check Vagrant for a version match without raising an error.
2018-09-07 11:37:30 +02:00
Chris Roberts 3ace82cc5b Update Vagrant.has_plugin? helper to function prior to plugin loading
Due to the Vagrantfile being loaded prior to plugin loading to determine
project local plugin information the Vagrant.has_plugin? helper will always
return false when the Vagrantfile is first loaded. To prevent this behavior
we can check for plugins in the plugin data files prior to the plugins
being loaded, and after they have been loaded we can fallback to the
original specification based check.
2018-08-31 14:03:42 -07:00
Chris Roberts e24728cb5a
Merge pull request #10155 from chrisroberts/f-plugin-load-config
Reset internal environment after plugin load
2018-08-30 11:30:14 -07:00
Chris Roberts 9b67655e45 Reset internal environment after plugin load
Force the vagrantfile and configuration loader to be rebuilt after
plugins have been loaded to properly allow newly introduced plugin
configurations to be properly supported within the Vagrantfile.
2018-08-30 10:44:09 -07:00
Chris Roberts 92109752a3 Fix local plugin prompt and add coverage 2018-08-30 10:35:16 -07:00
Mikhail Emelchenkov ed8ecd15e1
Fix: `trigger` embedded plugin fails to exec scripts at paths contains spaces 2018-08-17 15:14:54 -07:00
Brian Cain 57c48ee348
Merge pull request #10116 from briancain/fix-run-arg-trigger
Ensure trigger run args are an array prior to join
2018-08-17 15:10:52 -07:00
Brian Cain 29aba535ce
(#10104) Ensure trigger run args are an array prior to join
Prior to this commit, if the args key was a string rather than an array
of strings, the `join` command would fail when appending the arguments
to the run command for a given script. This commit updates that by
ensuring the `args` option is an array prior to joining the arguments.
2018-08-14 10:29:51 -07:00
Brian Cain e073153728
(#10099) Properly join commands from passed in array
Prior to this commit, the `Util::Powershell.execute_inline`
method didn't properly join the passed in command and instead attempted
to execute the array of strings. This commit updates that
behavior to join the command array prior to inserting it into the full
powershell command.
2018-08-14 09:30:11 -07:00
Chris Roberts 03d8965ef7 Add param documentation and fix key used for box version 2018-08-02 15:19:39 -07:00
Chris Roberts 6c1a9dc58e Store box metadata of active guest
When a guest is created, the box metadata information is stored in the
machine data directory. This allows modifications to happen to the
Vagrantfile definition of the box in use (box name change, box version
change, etc) while still allowing the Machine instance of an active
guest successfully load the box currently backing it.
2018-08-02 11:01:36 -07:00
Chris Roberts 66566b8c3d
Merge pull request #10078 from chrisroberts/e-appimage-libs
Detect AppImage and update executable environment if required
2018-07-31 13:56:35 -07:00
Chris Roberts 6009492e73 Detect AppImage and update executable environment if required
If starting a process while running from within AppImage adjust
the LD_LIBRARY_PATH of the subprocess when the executable exists
outside of the AppImage. This prevents issues of invalid dynamic
library lookups when the AppImage contains common named libraries.
2018-07-31 10:39:26 -07:00
Chris Roberts ba908052ec Also handle false value for compatibility 2018-07-30 11:58:49 -07:00
Chris Roberts e3e3a332b3 Include update in ssh util for verify_host_key value 2018-07-30 11:25:29 -07:00
Chris Roberts c0b871794c
Merge pull request #9926 from Telekom-PD/centos_75_nmcli_hang
Fix hang at nmcli call on CentOS 7.5 when ssh.pty is enabled
2018-07-27 12:11:30 -07:00
Chris Roberts a993cbce4e
Merge pull request #10037 from chrisroberts/e-vagrant-plugins-local
Define project specific plugins
2018-07-27 09:57:41 -07:00
Chris Roberts ae14f95124 Properly downcase answer for check. Default response to no. 2018-07-19 10:31:32 -07:00
Chris Roberts c660643abb Prevent matching on other Location headers
Prevent matching on custom headers that include the Location name
when checking for host redirection.
2018-07-19 09:18:30 -07:00
Chris Roberts a490a8c587
Merge pull request #9966 from conspicuousClockwork/#9965
Added option to add to User-Agent
2018-07-18 16:43:02 -07:00
Chris Roberts 27a441f0bd
Merge pull request #10001 from chrisroberts/e-wsl-valid-sync
Disable synced folders on non-DrvFs
2018-07-18 16:41:16 -07:00
Chris Roberts 2ba5c74e1c
Merge pull request #9998 from chrisroberts/f-plat-wsl-pathname
Always force string type conversion of path
2018-07-18 16:37:07 -07:00
Chris Roberts ab39125570 Set options directly instead of lazy merging 2018-07-18 15:47:35 -07:00
Chris Roberts c5a6790192 Only run bundler initialization if plugin initialization is enabled 2018-07-18 10:48:22 -07:00
Chris Roberts c605b7d875 Update option name for local plugin installation 2018-07-17 15:35:25 -07:00
Chris Roberts 3223737734 Use env_local consistently internally 2018-07-17 14:49:41 -07:00
Chris Roberts b71054502e Update local usage to env_local for clarity 2018-07-17 14:49:41 -07:00
Chris Roberts 84c0aafe71 Support non-interactive local plugin install 2018-07-17 14:49:41 -07:00
Chris Roberts 40f4e6f67e Vagrant Environment isolated plugins
Adds support for plugins isolated to a specific `Vagrant::Environment`
which can be managed by the vagrant plugin command using the the
--local flag.
2018-07-17 14:49:41 -07:00
Chris Roberts 01a7b625e5
Merge pull request #10017 from troeggla/master
Download causes exception when location header is not an absolute URL
2018-07-17 10:00:23 -07:00
Chris Roberts 6f81d16691 Remove final #to_s on path 2018-07-12 16:49:22 -07:00
Thomas Röggla 2613d620fd checking whether the field location_uri.host is nil 2018-07-12 15:49:26 +02:00
Brian Cain 52c3dcc70e
(#9997) Catch and allow for non-standard exit codes
Prior to this commit, the run trigger option wouldn't catch for failures
outside of the #Subprocess.execute raising exceptions. This commit fixes
that by inspecting the exit code result of the subprocess and using the
new `exit_codes` option to determine how to move forward with the
trigger.
2018-07-09 15:56:26 -07:00
Chris Roberts 859d48d5f5 Restrict synced folder access to DrvFs file systems only within WSL 2018-07-06 16:58:12 -07:00
Chris Roberts 6aa5c1a008 Always force string type conversion of path
Fixes #9984
2018-07-06 14:29:32 -07:00
Koen Verheyen 7939784d1b Display current version in version check 2018-06-29 16:41:50 +02:00
Caleb Martinez 447e58dac3
Added option to add to User-Agent 2018-06-28 13:21:34 -04:00
Chris Roberts 69ece0db4e Always return string value when converting path 2018-06-18 10:02:59 -07:00
Chris Roberts c5c63d291d Only expand path if not in windows format 2018-06-18 09:39:30 -07:00
Chris Roberts 97eb459f56 Always expand to full path before converting to Windows path 2018-06-18 09:07:12 -07:00
Chris Roberts 3f23466703 Replace file separators when decompressing box files 2018-06-18 08:57:29 -07:00
Chris Roberts 55aaa1d258 Update path usages to support Hyper-V provider access from WSL 2018-06-15 09:03:18 -07:00
Chris Roberts 5357727350 Attempt full path to powershell as last resort in WSL 2018-06-15 09:03:18 -07:00
Simon Baatz fa34f4d2af Fix hang at nmcli call on CentOS 7.5 when ssh.pty is enabled
`vagrant up` may hang at the "Configuring and enabling network
interfaces..." step when private networks and PTY allocation for SSH
are used.

The newer version of `nmcli` that is part of CentOS now will open a
pager (i.e. `less`) for certain commands if it finds a tty. This
causes the invocations of `nmcli` in `guest_inspection.rb` to hang.

`nmcli` disables the use of a pager in 'terse' (`-t`) output mode,
while still returning enough information for the uses in
`guest_inspection.rb`.
2018-06-13 11:10:18 +02:00
Chris Roberts ef4d431d36 Remove console resizing on powershell commands 2018-06-12 16:47:47 -07:00
Chris Roberts 87b8321702 Remove win32 dependencies 2018-06-12 13:54:37 -07:00
Chris Roberts 5325000fa6 Add helper option for setting custom module path on PowerShell executes 2018-06-12 10:44:12 -07:00
Chris Roberts 5f4e661155 Add automatic console resize and environment support for powershell commands 2018-05-30 15:04:59 -07:00
Chris Roberts e6457d5061 Overhaul the Hyper-V provider 2018-05-24 14:43:44 -07:00
Brian Cain 5ca382727d
Raise error if argument is provided with `--all-global` flag
This commit raises an error if additional arguments are provided to the
suspend command when the `--all-global` flag is used.
2018-05-11 15:43:14 -07:00
Chris Roberts 91018d4edc Remove existing items from request set prior to installation 2018-05-08 13:52:23 -07:00
Chris Roberts d58096da31 Update plugin loading to prevent error suppression
Only catch exception types we care about when attempting to load
plugins. If no require call is successful, force an exception
instead of ignoring.
2018-05-08 13:47:31 -07:00
Brian Cain a177bcf4b7
Ensure internal trigger fire does not get called if plugin installed
This commit wraps up the internal machine action level trigger calls if
the community vagrant-trigger plugin is installed.
2018-05-07 11:33:55 -07:00
Brian Cain 092e73d87f
(#9775) Move triggers object init in machine
Prior to this commit, the hyper-v provider called an action on a machine
that hadn't fully finished initializing. This commit fixes that by
moving up the initialization of the triggers object next to the rest of
the instance variables of the machine object.
2018-05-04 14:32:57 -07:00
Chris Roberts 02b9d625d3
Merge pull request #9759 from StefanScherer/wsl-remove-raise-vboxmanage-missing
Allow other providers in WSL
2018-05-03 12:42:16 -07:00
Brian Cain beb08b51a4
(#7076) Continue on if vagrant fails to parse metadata box for update
Prior to this commit, vagrant would halt if it could not parse the
metadata file for a box to check for updates with. This commit changes
that to behave like when vagrant fails to download a metadata file and
continue on but warn the user it failed to check for box updates.
2018-05-02 13:58:21 -07:00
Stefan Scherer f14e8bcbf2
Allow other providers in WSL 2018-05-02 22:36:17 +02:00
Chris Roberts 3f3777f03a
Merge pull request #9746 from chrisroberts/e-hyper-v-check
Update Windows Hyper-V check
2018-05-02 07:45:26 -07:00
Chris Roberts 3dcc350364
Merge pull request #9696 from D4rkSh1t/fix-rootpath-for-wsl
fix rootpath if the vagrantfile is located under the root directory (WSL)
2018-04-27 17:04:23 -07:00
Chris Roberts a997a27b57 Update Windows Hyper-V check
Checks only if the Hyper-V hypervisor is enabled instead of all
Hyper-V features. This will allow detection where Hyper-V is in
use for things like ApplicationGuard.

Uses both Get-WindowsOptionalFeature and Get-WindowsFeature to
support check on server and non-server version.
2018-04-27 14:13:34 -07:00
Brian Cain fd3d78746c
(#9717) Improve messaging around not finding requested provider
This commit adds a bit more helpful messaging for the user when asking
for a provider that might not exist or does not follow the correct
casing. If it can find a match on a provider it knows about, it will
suggest it.
2018-04-26 09:43:58 -07:00
Brian Cain 67c3f866dd
(#7886) Add tests and simplify code for continuing on 416 2018-04-25 14:03:24 -07:00
Alexey Kamenskiy f1993dfa19
Fixed minor typo in comment 2018-04-25 09:12:08 -07:00
Alexey Kamenskiy cd3035e5e9
Issue #7885 Don't raise error if response is 416
416 means there is no more bytes to download (which works only with `--continue-at -` of curl)
2018-04-25 09:12:08 -07:00
Brian Cain a9be56b356
Code updates based on PR feedback 2018-04-24 10:04:40 -07:00
Brian Cain daffd87200
Use match over match? for Ruby 2.3 2018-04-20 12:24:32 -07:00
Brian Cain 188fd5d6a6
Split out run methods with Powershell functions 2018-04-20 10:51:38 -07:00
Brian Cain 12b1a3dfe4
Update triggers based on code review 2018-04-20 10:51:38 -07:00
Brian Cain 4e5e4d0214
Use args setting for run option in trigger 2018-04-20 10:51:38 -07:00
Brian Cain 8451cbf854
Move up location of error message 2018-04-20 10:51:38 -07:00
Brian Cain c35e0a4f9a
Update docs with some basic trigger examples 2018-04-20 10:51:38 -07:00
Brian Cain e0806f623c
Remove TODO 2018-04-20 10:51:38 -07:00
Brian Cain 0054c5aae6
Raise error if incomplete trigger block is defined 2018-04-20 10:51:38 -07:00
Brian Cain 6bf01965de
Fix run command for windows hosts 2018-04-20 10:51:38 -07:00
Brian Cain a5fe84d64f
Fix string translation 2018-04-20 10:51:38 -07:00
Brian Cain 7cdb32f642
Use inclunde? instead of any? for ruby 2.3 2018-04-20 10:51:38 -07:00
Brian Cain 767a315393
Trigger cleanup 2018-04-20 10:51:38 -07:00
Brian Cain 85dedf25d9
Ensure that :all triggers don't get filtered out 2018-04-20 10:51:38 -07:00
Brian Cain 600557ff24
Move strings to translation file 2018-04-20 10:51:38 -07:00
Brian Cain a1e4fe4411
Align how local provisioner looks with shell provisioner 2018-04-20 10:51:38 -07:00
Brian Cain a857056136
Update color for run_remote to match shell provisioner colors 2018-04-20 10:51:38 -07:00
Brian Cain 8b71c24f90
Match properly on guests with trigger filtering 2018-04-20 10:51:38 -07:00
Brian Cain a4faaa1a4d
Provision run_remote using the shell provisioner 2018-04-20 10:51:38 -07:00
Brian Cain fd2878309b
Move exception warnings in run function 2018-04-20 10:51:38 -07:00
Brian Cain e078767b2b
run now supports script files as well as inline scripts 2018-04-20 10:51:38 -07:00
Brian Cain 8b70abd4d0
Send the correct config message to warn 2018-04-20 10:51:38 -07:00
Brian Cain 59965f4fd6
Properly filter triggers 2018-04-20 10:51:38 -07:00
Brian Cain 975b8e774c
Get basic run triggers executing inline scripts 2018-04-20 10:51:38 -07:00
Brian Cain d750169f6e
Add some logging around run and run_remote 2018-04-20 10:51:38 -07:00
Brian Cain 616b0f9ba6
Preserve returning environment after machine action gets called 2018-04-20 10:51:38 -07:00
Brian Cain 48b7c682ad
Use active machine object 2018-04-20 10:51:38 -07:00
Brian Cain 93af398f9e
Update params for NoStageGiven error 2018-04-20 10:51:38 -07:00
Brian Cain bbf4e3c521
Reduce fire trigger methods to a single method 2018-04-20 10:51:38 -07:00
Brian Cain eac2fcf71e
Filter triggers based on only_on restraint 2018-04-20 10:51:38 -07:00
Brian Cain 6373441ab2
Ensure guest name is a string 2018-04-20 10:51:38 -07:00
Brian Cain 76418b9fcd
Simplify trigger selection 2018-04-20 10:51:38 -07:00
Brian Cain 0e5cd900f8
Add missing param 2018-04-20 10:51:38 -07:00
Brian Cain 1462b3f718
Simplify trigger command filtering 2018-04-20 10:51:38 -07:00