97 Commits

Author SHA1 Message Date
Jeff Bonhag
df7c11a3a7 Fix issues with Windows SSH provisioner
Windows commands that run over SSH are wrapped in a script that writes a
special marker to the two output streams (stdout and stderr).  This
allows Vagrant to consume the output streams.

Unfortunately, this leads to a sort of chicken-and-egg problem where no
commands can be run before a wrapper script exists. For example, you
can't make a destination directory to upload the wrapper script without
first creating a wrapper script to make the directory. :)

This commit changes the behavior of the WinSSH communicator to assume
that the destination directory already exists for provisioning scripts.

It also moves the default `upload_path` from the shell provisioner
config so we can have OS-specific defaults.

Finally, it introduces a Windows-specific #upload method which will
properly use a Windows path separator on a non-Windows host.
2020-03-04 15:08:03 -08:00
ngyuki
924e87342b Use wslpath command for customized root on WSL 2019-01-09 03:59:40 +09:00
Chris Roberts
43f7a16baa
Merge pull request #10313 from lloesche/lloesche/fix_wsl_detection
Fix WSL detection for customized roots
2018-11-12 16:21:44 -08:00
Chris Roberts
ca81f9d6cb Prevent exception from raising on hyper-v check 2018-10-24 17:06:47 -07:00
Lukas Lösche
73cb4b5b42
Fix WSL detection for customized roots 2018-10-18 15:13:18 +02:00
Chris Roberts
67bb5d2e6c Update Hyper-V admin check 2018-10-08 14:39:40 -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
6f81d16691 Remove final #to_s on path 2018-07-12 16:49:22 -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
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
55aaa1d258 Update path usages to support Hyper-V provider access from WSL 2018-06-15 09:03:18 -07: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
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
Maximilian Gotter
134060d577 fix rootpath if the vagrantfile is located under the root directory 2018-04-17 07:10:41 +00:00
Chris Roberts
e4399a5724 Check Windows installed Vagrant version using --version
Using the --version flag keeps Vagrant from doing a full startup
and prevents the Vagrantfile from being parsed. This makes the
version check faster, and stops things like syntax errors within
a Vagrantfile from causing an unexpected error.

Fixes #9635
2018-04-10 08:05:23 -07:00
Chris Roberts
8ac0fedbbb Suppress errors from invalid path encoding and carry on with best effort
Fixes #9299
2018-04-04 16:09:46 -07:00
Chris Roberts
8b7e501e50 Handle pathing in lxrun generated WSL instances better. 2018-02-28 10:08:01 -08:00
Chris Roberts
5f0d16a0e9 Include support for lxrun generated install
Adds compatibility support for legacy lxrun generated WSL installation
which is a single install at a known path location. This allows earlier
versions of Windows 10 to continue working as expected while still
supporting the recent updates allowing for multiple instances.
2018-02-28 10:08:01 -08:00
Sergii Bondarenko
cc82f96618 #9298: Fix typos in comments to the code 2018-02-28 10:08:01 -08:00
Sergii Bondarenko
c5fdd47a56 #9298: Respect usernames with spaces 2018-02-28 10:08:01 -08:00
Sergii Bondarenko
a1211caa9c #9298: Add debugging messages and explanations to the code 2018-02-28 10:08:01 -08:00
Sergii Bondarenko
62740e2240 #9298: Increase stability of determination of a current WSL instance 2018-02-28 10:08:01 -08:00
Sergii Bondarenko
72664eafec #9298: Use a single-word distro name 2018-02-28 10:08:01 -08:00
Sergii Bondarenko
476981874b #9298: Compute a correct path to the current WSL instance 2018-02-28 10:08:01 -08:00
Brian Cain
e8708232a5
(#9258) Exit if Hyper-V is enabled and VirtualBox provider is used
This commit adds a function on windows for the VirtualBox provider to
check if Hyper-V is enabled. If so, exit and display a warning to the
user that going forward will result in a system crash.
2018-02-08 11:20:41 -08:00
Chris Roberts
d422053fbc Check for vagrant.exe path before validating versions 2017-10-24 16:53:53 -07:00
Brian Cain
3c9e1c9d84 (#8954) Split out cygwin path and ensure bin exists
This commit splits out the msys2 and cygwin path functions for
expanding a path with the cygpath tool. It also ensures that the tool
itself exists when the Which class is called so that it doesn't attempt
to escape slashes on nil.
2017-09-15 10:33:04 -07:00
Chris Roberts
fcd1aee9bb Update linux host NFS capability
Add support for systemd detection and using correct method
for starting/checking host nfs service.
2017-09-06 09:54:06 -07:00
Brian Cain
b45ee4f455 (#6656) Format windows paths for ssh_config command
Prior to this commit, if the ssh-config command was invoked within
cygwin or msys2, it would show a regular windows style path for private
keys rather than a path that could be used within msys2 or cygwin. This
commit updates that behavior by converting all of the private key paths
to the proper msys2 or cygwin path if the platform is windows and the
command was invoked from one of those two shells.
2017-08-25 13:17:19 -07:00
Roman Semenov
fc1e4f7533 Fix #8901 2017-08-18 18:58:45 +03:00
Chris Roberts
954569d1fc Remove PATH based cygwin detection
Detecting cygwin via PATH contents can result in false positives
resulting in errors when using Vagrant on Windows outside of a
cygwin shell. Use environment based detection instead.
2017-07-03 14:40:27 -07:00
Chris Roberts
6de7c9b445 Only convert path if windows access is granted 2017-05-12 14:14:11 -07:00
Chris Roberts
3c44ce9742 Support vbox provider within WSL rootfs. Make Windows access easier.
Enables proper setup of VMs started from within WSL rootfs paths. Updates
setup for Windows access when working within the WSL to auto-detect settings
instead of relying on user defined environment variables.
2017-05-12 13:11:53 -07:00
Chris Roberts
10cb43b917 Use helper module to silence warnings 2017-05-08 17:03:38 -07:00
Chris Roberts
e8e38a4007 Halt Vagrant if within WSL and attempting to operate out of rootfs 2017-05-08 15:21:39 -07:00
Chris Roberts
4df4f77bf6 Match WSL installed Vagrant with Windows installed Vagrant 2017-05-08 10:21:01 -07:00
Chris Roberts
83b0c87f52 Support running Vagrant within the Windows Subsystem for Linux 2017-05-08 10:21:01 -07:00
John Rizzo
1dfc646fb3 Fixed admin test to verify that you are running in an elevated shell, not that you are in the administrators group since that is not required. 2017-05-01 15:42:06 -07:00
Chris Roberts
a8b2f78f59 Do not prefix Windows paths if UNC prefix already exists
While VirtualBox has commented that they do not support UNC remote
paths (but do for long paths) it seems that remote paths can work.
If user provides UNC path, allow it to be used as-is.

Fixes #7011
2017-04-20 16:33:38 -07:00
Luke Bakken
52e98ffdfb Improve detection of admin and hyper-v admin rights via using SIDs and powershell 2016-10-13 14:22:08 -07:00
Seth Vargo
1702584d1e Merge pull request #6765 from PeterMosmans/windows-path-fix
Fix for #6761 (fixes incomplete #6598)
2016-08-08 11:59:26 -04:00
Seth Vargo
d01ddeeb43
Check stdout instead of process output
Fixes GH-7465
2016-06-16 16:20:15 -04:00
Seth Vargo
2a230a11e2
Cache the results of common operations
This commit changes Vagrant::Util::Platform to cache the result of some
common operations. These values are highly unlikely to change over the
course of a single Vagrant run and they are only cached for that run.
2016-05-30 18:27:12 -04:00
Seth Vargo
3d2390fc94
Give a unique, prefixed name to all tempfiles
This commit basically grepped the code base for all uses of Dir.mktmpdir
and Tempfile.new/open and ensures the value is unique within the
code base and also prefixed with `vagrant-`.

Previously, most invocations of these commands simply used "vagrant",
thus making them indistinguishable when trying to identify leaks.
2016-05-28 23:22:34 -04:00
Seth Vargo
1166800b65 Use SSL and HTTPS links where appropriate 2016-01-25 13:14:54 -05:00
Peter Mosmans
4b889ee641 Fix for #6761 (fixes incomplete #6598) 2015-12-30 07:56:08 +10:00
Mitchell Hashimoto
cf4b03d701 core: do not convert drive letters to UNC paths [GH-6598] 2015-12-24 12:36:14 -08:00