70 Commits

Author SHA1 Message Date
Chris Roberts
f9d1025688
Merge pull request #11880 from elastio/bug/11878-rsync-fails-on-windows
[WIP] Change `mkdir` command on Windows for rsync
2021-11-04 15:03:20 -07:00
Chris Roberts
4751353a5f Fetch reboot env var at run time and keep constant values constant
Keep the default duration as a constant and fetch the custom environment
variable at run time with a fallback to the default. Set the sleep duration
into a constant and add tests covering the expected behaviors when the
default duration is in use as well as the override value. Also match the
environment variable up with the constant just for consistency.
2020-11-03 15:11:10 -08:00
Arthur Maltson
a2f5d615a0 Make max reboot retry duration configurable
Previously the maximum amount of time Vagrant would poll for whether a
machine has successfully reboot was hard coded to 120 seconds. This
change introduces the VAGRANT_MAX_REBOOT_RETRY_TIMEOUT environment
variable to allow this attribute to be configurable.

Add RSpec tests of the maximum retry logic. Since the maximum retries
are configured as a constant, we'd need to reload the class and that's
fairly ugly to do in RSpec.

Fixes #11695
2020-10-31 18:00:01 -04:00
Adam Nelson
a606822fff Change mkdir command on Windows for rsync
This corrects the `mkdir` command used by rsync on Windows to make sure
the destination directory exists before starting to sync.  The old form
was correct on Linux but not on Windows, and it was just a coincidence
that the `-p` argument appeared to be work.
2020-09-04 12:01:41 +02:00
Jeff Bonhag
6efdcd2068
Merge pull request #11430 from chrisroberts/winssh-hacks
Fix issues with Windows SSH provisioner (continued...)
2020-03-11 10:39:44 -04:00
Chris Roberts
ec9d23a531 Update public key cap to use powershell 2020-03-04 15:08:03 -08:00
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
Chris Roberts
6f707c829d Catch any StandardError exception while waiting for Windows reboot
This prevents any unexpected connection related error from breaking
the wait loop while windows reboots. If an underlying problem unrelated
to the guest is causing exceptions, the exception will still be raised
to the user, simply after the loop has exceeded the defined maximum
wait time.

Fixes #11238
2020-03-03 17:02:04 -08:00
Rui Lopes
ba71c30e04 retry the wait for a windows reboot on connect timeout errors 2019-09-28 12:20:10 +01:00
Chris Roberts
ade5370db3 Add reboot output to guest capability 2019-02-01 15:47:02 -08:00
Brian Cain
796ff7b190
Remove logger from windows hostname cap 2018-11-05 14:12:16 -08:00
Brian Cain
377b900277
Only execute reboot check if guest communicator is ready 2018-11-02 16:33:36 -07:00
Brian Cain
142a6898bc
Add reboot cap for windows
This commit introduces a proper reboot cap for Windows guests. Once it
initiates a reboot on the guest, it calls out to the wait_for_reboot cap
to block on until the guest is finished rebooting.
2018-11-02 15:25:57 -07:00
Brian Cain
54c8ebc31a
Fixes #10229: Add timeout for changing hostname on windows
Prior to this commit, if Windows was slow to reboot, Vagrant would fail
to find the right IP address to upload the wait_for_reboot script to.
This commit fixes this race condition by adding a timeout to ensure that
Vagrant can retry. It also properly catches an exception in the winrm
ready? method for checking if a guest is properly ready for
communications.
2018-11-02 09:23:00 -07:00
Chris Roberts
48d358adcb Add winrm and upload commands 2018-10-04 13:26:41 -07:00
John Rizzo
b7d702ab5f
Update mount_shared_folder.rb
This change allows special characters in the password such as ) which will cause cmdkey to fail without the quotes.
2018-09-18 13:34:32 -07:00
William Bowling
4ec865b69d
Make sure that the correct cmd is run
After installing msys2, there is another `cmd` on the path which prevents shared folders from being mounted. Explicitly calling `cmd.exe` fixes the issue
2018-07-02 13:15:10 +10:00
Brian Cain
f1de9821e1
Merge pull request #8099 from chrisroberts/windows/shared-folder-path
Fix virtualbox shared folders path
2018-04-10 09:16:06 -07:00
ajpaul
2c9e9e9ab8 reintroduce sleep_timeout for guests that fail the :wait_for_reboot capability check 2018-03-16 13:53:27 -04:00
Adam Paul
2dfe520eb8 add capability test before attemping to use capability 2018-03-15 11:45:42 -04:00
Adam Paul
76551a1692 Fix graceful_halt_timeout issue #8486 2018-03-15 10:38:07 -04:00
Chris Roberts
2caf109a03 Mark passwords as sensitive within guest capabilities 2017-12-21 12:49:34 -08:00
Brian Cain
c7ec0a42a5 (#8941) Include WinSSH Communicator
This commit requires the winssh communicator class wihtin the public_key
capability for Windows. Prior to this commit users could run into a
situation where Vagrant would check if the machine could speak in WinSSH
and fail on an uninitialized constant.
2017-10-24 12:02:01 -07:00
Chris Roberts
6eca74afc7 Merge pull request #9012 from benh57/winssh_communicator_fix
Fix guest network setup with winssh communicator
2017-10-23 15:41:53 -07:00
Brian Cain
fb1501d48a Merge pull request #8874 from taliesins/HandleChefProvisionerRebootRequest
Handle chef provisioner reboot request
2017-10-04 09:37:02 -07:00
Ben Hines
ea518f6c78 test() defaults to powershell for winssh, no need to pass it 2017-09-29 19:30:07 -07:00
Ben Hines
6b4584efb6 Use the 'powershell' shell when running powershell commands. Allows winssh communicator to function 2017-09-29 19:17:49 -07:00
Chris Roberts
93f6451261 Retain winssh_ method prefix on auth key helper 2017-08-21 14:48:52 -07:00
Rui Lopes
7fac854cf3 winssh communicator: simplify the authorized_keys file modification 2017-08-21 14:42:18 -07:00
Rui Lopes
4ab0dc19b1 winssh communicator: retain the authorized_keys file acl permissions 2017-08-21 14:42:18 -07:00
Rui Lopes
aeac480683 winssh communicator: fix public key insertion 2017-08-21 14:42:18 -07:00
Taliesin Sisson
820d80852c If this is called during a shutdown then exception code 1115 is throw. 2017-08-10 11:14:52 +01:00
Chris Roberts
cef38eefd0 Add public key capability to Windows guests for winssh communicator 2017-07-07 11:26:32 -07:00
Tim Aslat
630858b9a8 This patch fixes an issue when using rsync folders on windows clients with cygwin & ssh enabled.
Before the patch this error will happen if the original directory already exists

-------------------------------------------------------------------------------------------------
==> windows: Rsyncing folder: /vhosts/oxfamshop.com.au/ => /cygdrive/c/inetpub/wwwroot
==> windows:   - Exclude: [".vagrant/", ".git/", "target/", "node_modules/"]
==> windows: Showing rsync output...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir '/cygdrive/c/inetpub/wwwroot'

Stdout from the command:

Stderr from the command:

mkdir: cannot create directory ‘/cygdrive/c/inetpub/wwwroot’: File exists
-------------------------------------------------------------------------------------------------

After the patch, this is result

-------------------------------------------------------------------------------------------------
==> windows: Rsyncing folder: /vhosts/oxfamshop.com.au/ => /cygdrive/c/inetpub/wwwroot
==> windows:   - Exclude: [".vagrant/", ".git/", "target/", "node_modules/"]
==> windows: Showing rsync output...
==> windows: rsync[stdout] -> sending incremental file list
==> windows: rsync[stdout] ->
==> windows: rsync[stdout] -> sent 500855 bytes  received 6635 bytes  78075.38 bytes/sec
==> windows: rsync[stdout] -> total size is 175357552  speedup is 345.54
-------------------------------------------------------------------------------------------------
2017-05-16 16:38:29 +09:30
Chris Roberts
ee79dd0575 Enable windows guest capabilities using winssh communicator 2017-05-05 14:04:54 -07:00
Chris Roberts
21e195c75a Merge pull request #7425 from tjuerge/6220-mount_shared_folder-via-ssh
Add support for mounting synched folders on windows guest via ssh
2017-04-05 15:11:32 -07:00
Chris Roberts
7f9a4b67d2 Fix virtualbox shared folders path 2016-12-13 12:09:36 -08:00
Seth Vargo
b29864f450
Use symbols for defining guest capabilities 2016-06-17 19:55:04 -04:00
Torsten Juergeleit
754c1eebe5 fixes #6220 - adds check for communicator type and executes the mount script as encoded command via powershell from within 'sh' for communicator != winrm 2016-06-11 16:40:25 +02:00
Seth Vargo
1166800b65 Use SSL and HTTPS links where appropriate 2016-01-25 13:14:54 -05:00
Mitchell Hashimoto
d69d7047b2 Merge pull request #6386 from legal90/fix-osx-nic-order
Fix network configuration in OS X (Darwin) guests
2015-11-18 14:33:51 -08:00
Mikhail Zholobov
f930fa94af Move "cant_read_mac_addresses" error to the global space
Now it is used not only by Windows, but by Darwin guests as well.
2015-10-09 14:57:41 +03:00
Lonnie VanZandt
b897fd7365 Scrub Guest Paths for Windows Rsync leaving Dirty Paths for Winrm Mkdir
Windows offers no out-of-the-box rsync utility. By far, the most
commonly used external utilities for Windows rsync are built with the
GNU Cygwin libraries. The cost for this convenience is that rsync on
Windows has to be provided paths that begin “/cygdrive/c” rather than
“c:/“ like other Windows-API utilities. Compounding the situation,
rsync doesn’t create paths/to/sub/targets and so the vagrant plugin
code, when performing an rsync, is responsible for creating
intermediate directories in guest paths if there are any. Furthermore,
the mkdir utility in Windows is not another Cygwin utility like rsync
but the routine mkdir of Windows command.com. Therefore, while rsync
needs the /cygwin paths, mkdir uses the Windows paths. Later, the
chef_solo.rp provisioner running within the guest will expect to find
Windows-style paths in its solo.rb configuration file. Due to all this,
vagrant has to keep track of both the original, possibly dirty Windows
guest path and the cygwin-scrubbed guest path.
2015-08-18 10:56:13 -06:00
Ben Jansen
992c148169 Ignore Windows NICs with nil :net_connection_id
When upping a Win XP box, vagrant found a lot of "virtual" network
connections that did not have DHCP enabled, and tried to configure them
for DHCP. This did not work because their :net_connection_id is nil.
Ignoring these network connections enabled the XP box to be upped.
2015-03-13 11:49:15 -07:00
Mitchell Hashimoto
4e32155b95 Merge pull request #5261 from blairham/revert-4693-master
Revert "Rename Windows guest without reboot"
2015-02-24 09:59:53 -08:00
Blair Hamilton
7784ee2d09 Revert "Rename Windows guest without reboot" 2015-01-28 20:00:24 -05:00
Richard Guin
56a6c85e7d Windows rsync needs to create folders before syncing 2015-01-28 13:07:36 -05:00
uchagani
2d465ea923 Fixed escape character problem in registry path 2014-10-23 11:27:14 -04:00
uchagani
90cbdd85e1 Rename Windows guest without reboot 2014-10-23 02:27:05 -04:00
Matt Wrock
d820bef6f4 filter host IPs to those that resolve on guest when finding addresable IPs on a windows guest 2014-08-11 00:07:21 -07:00