13527 Commits

Author SHA1 Message Date
Chris Roberts
852c549886 Force powershell on connection for consistent behavior
This patches the connection instances generated for the winssh
communicator so when a command is executed it is always run
with powershell. This prevents inconsistencies with argument
handling based on what the default shell is set to on the remote
side.

Since powershell is the default, environment variable template
only needs to be set for powershell style. If the shell setting
is updated to `cmd`, the command will be properly prefixed.

Default shell has been updated to powershell, to prevent extraneous
wrapping where it's not required. The `#ready?` check has also been
updated to use a constant value, which is overridden within winssh
as a blank command is invalid.
2020-03-04 15:08:03 -08:00
Jeff Bonhag
9a26c123b9 Use SFTP for Windows file transfer
SFTP is more reliable than SCP when dealing with unknown sshd
configurations on the server side. It also provides a convenient
facility for creating remote directories, so we can remove the
Windows-specific `#create_remote_directory` method.
2020-03-04 15:08:03 -08:00
Jeff Bonhag
b2aa16dc78 Set remote script extension from local script extension 2020-03-04 15:08:03 -08:00
Jeff Bonhag
b6e8262bf2 Perform scp commands with powershell.exe
This commit includes a monkey patch for Net::SCP#start_command so that
PowerShell commands are escaped correctly.
2020-03-04 15:08:03 -08:00
Jeff Bonhag
85f0fce57a Allow #provision_winrm to modify upload_path
We need to ensure that Windows files have an extension when provisioning
via WinRM.
2020-03-04 15:08:03 -08:00
Jeff Bonhag
d1ad67e333 No need to explicitly set UNSET_VALUE 2020-03-04 15:08:03 -08:00
Jeff Bonhag
4b7d55afaa Fixup paths to work with server-side Bash
This commit normalizes our Windows paths to use `/` instead of `\`.
These paths are compatible with both cmd and PowerShell, and are
required if the server-side shell is set to Bash.

The OpenSSH server executes all commands inside a default login shell
which cannot be controlled by the Vagrant configuration. So what ends up
getting executed on the server side looks something like this:

    "c:\\program files\\git\\bin\\bash.exe" -c "C:\\Windows\\Temp\\vagrant-ssh20200130-41670-1w5nsjy.bat"

By flipping the direction of the directory slashes, we end up with:

    "c:\\program files\\git\\bin\\bash.exe" -c "C:/Windows/Temp/vagrant-ssh20200130-43415-f1d5n2.bat"

This works whether the server-side shell is set to cmd, powershell, or
bash.
2020-03-04 15:08:03 -08:00
Jeff Bonhag
fcd07e3a37 Switch to PowerShell for create_remote_directory 2020-03-04 15:08:03 -08:00
Jeff Bonhag
3b5443a5e7 We are back to creating config.winssh_upload_directory 2020-03-04 15:08:03 -08:00
Jeff Bonhag
8affdd24b6 Wire up inline command for popular Windows shells
* Remove connection between shell provisioner directory config and WinSSH
directory config because these should remain separate.
2020-03-04 15:08:03 -08:00
Jeff Bonhag
ee486203d1 Introduce force_raw option 2020-03-04 15:08:03 -08:00
Jeff Bonhag
e829902e0a Add missing method to test double 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
Noel Quiles
3b1c702744
Update middleman-hashicorp to 0.3.44 2020-03-03 20:10:38 -05: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
Chris Roberts
eba18091f9
Merge pull request #11391 from chrisroberts/fix/winrm-server-retry
Update exit code value used for retry check - ArgumentException
2020-03-03 16:26:33 -08:00
Chris Roberts
89aad950ca
Merge pull request #11422 from Murathe/patch-1
Update index.html.md
2020-03-03 16:25:42 -08:00
Chris Roberts
3686aed72d Add test coverage for dynamic action hook support 2020-03-03 16:23:31 -08:00
Chris Roberts
660166720b Update delayed execution implementation to utilized appended action hook 2020-03-03 16:23:31 -08:00
Chris Roberts
98f0ec6ab7 Dynamically apply hooks to actions prior to execution
Removes dynamic calls of before/after hooks and replaces it with
proper lookups for hooks defined for the action to run. If hooks
are found for an action, the action is placed in a new builder
and the hooks are applied. The new stack is extracted, finalized,
and then executed.
2020-03-03 16:23:31 -08:00
Chris Roberts
2ac12cfde8 Add new hook lookup method and key generation helper 2020-03-03 16:13:41 -08:00
Chris Roberts
2186e92539 Add Hook class to the autoload list 2020-03-03 16:13:13 -08:00
Brian Cain
6beea47d9c
Merge pull request #11426 from bat9r/patch-1
Missed comma in configuration file
2020-03-03 13:26:50 -08:00
Mike
2d7b959136
Missed comma in configuration file
Vagrant throws this error
syntax error, unexpected tIDENTIFIER, expecting keyword_endate_network, type: "dhcp" name: "hap-network"
2020-03-03 21:24:06 +02:00
ibrahim.dursun
fb8180a843
Fix #11271: catch IdentityNotMappedException
Some IdentityReferences cannot be translated to
[System.Security.Principal.SecurityIdentifier] because they don't map to
a SecurityIdentifier.

An example is:
IdentityReference : APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES

In such case, it is better to catch the exception and treat it as $false.
2020-03-03 15:57:21 +00:00
Murathe
f454a9903b
Update index.html.md
Added  'it' to the excuse formation
2020-03-02 17:09:18 +03:00
Alexzander thunder Shevchenko
8aa1aee155 Cleanup redundant lines 2020-02-23 20:33:53 +03:00
Alexzander thunder Shevchenko
24a3016f2b Add Alpine into provider capability 2020-02-23 20:31:07 +03:00
Alexzander thunder Shevchenko
5ea65e9534 Add Alpine Ansible capability 2020-02-23 20:30:35 +03:00
Jeff Bonhag
74e54483c6
Update CHANGELOG 2020-02-18 15:17:00 -05:00
Jeff Bonhag
a10b2c3108
Fix #11403: Parse list dhcpservers output on VirtualBox 6.1 (#11404)
This commit creates a custom `read_dhcp_servers` method in the
VirtualBox 6.1 driver to handle changes made in the ouput of
`VBoxManage list dhcpservers`.

Tests for VirtualBox 6.1+ can no longer use the shared examples for the
VirtualBox 4.x driver, because the `read_dhcp_servers` change is not
backwards compatible.

This commit also creates the boilerplate for a VirtualBox 6.x shared
example in case we want to put tests there in the future.
2020-02-18 15:14:31 -05:00
Robin Munn
25b13b2346 Update tests to expect new Arch network config 2020-02-15 20:25:38 +07:00
Robin Munn
6671cc6986 Use systemd-networkd on Archlinux guests
Fixes #11254
2020-02-15 15:42:35 +07:00
Jeff Bonhag
1ef024984b
Update CHANGELOG 2020-02-14 12:12:59 -05:00
Jeff Bonhag
08c3c741fe
Fix #11396: Use sudo to detect if systemd in use (#11398)
This change allows the vagrant user to see the systemd process in the
event that the hidepid mount option is enabled.

Also adds sudo: true to other tests that use `systemd?`
2020-02-14 12:10:59 -05:00
Brian Cain
1fc127ec54
Update CHANGELOG 2020-02-14 08:35:19 -08:00
Brian Cain
3d2eafc414
Merge pull request #11349 from briancain/feature/virtualbox-disk-mgmt
[FEATURE] Disk management with the VirtualBox provider
2020-02-14 08:33:51 -08:00
Brian Cain
96d7c19c06
Abstract out recovery method for resizing disk failures
This commit moves out the recovery steps for failures when Vagrant
attempts to resize disks. It wraps itsemf in a begin/rescue in case an
additional error occurs, we can still surface the original error that
caused the resizing to fail.
2020-02-13 09:42:18 -08:00
Chris Roberts
e430809cdd Update exit code value used for retry check - ArgumentException 2020-02-12 16:42:21 -08:00
Brian Cain
625bbf9cc8
Add more specific rescue exceptions for when errors occur for resizing
disks
2020-02-12 16:26:18 -08:00
Brian Cain
42133ad34e
Move strings into locales file 2020-02-12 16:22:02 -08:00
Brian Cain
37f8df174c
Freeze all values in valid disk ext default types 2020-02-12 16:00:23 -08:00
Brian Cain
baabf6650f
Check for provider capability with disk_ext types before using it 2020-02-12 15:59:37 -08:00
Brian Cain
dafb60ad4f
Update experimental feature flag for disk 2020-02-12 15:38:34 -08:00
Brian Cain
c179b2fb22
Include updated unit tests for disk ext update 2020-02-12 13:51:59 -08:00
Brian Cain
c5f4534487
Add virtualbox capability for validating disk extension types 2020-02-12 13:21:09 -08:00
Brian Cain
2174f4c219
Write up recovery message for when vagrant fails to resize vmdk disks 2020-02-12 10:24:38 -08:00
Brian Cain
d5e12dab17
Store backup disk location as local var 2020-02-12 09:56:41 -08:00
Brian Cain
efde9595c4
Add error case handling for resizing vmdk disks 2020-02-12 09:32:38 -08:00
Brian Cain
1826d210a0
Recover from cloning and resizin disk failures
This commit adds some recovery if Vagrant fails to reattach or clone a
vmdk disk that needs to be resized. It first moves the original disk
(after cloning) to a backup file. If something fails, it will reattach
the original disk to the guest and continue to raise the exception.
2020-02-11 16:02:24 -08:00