When user is using podman's docker CLI emulation the containers would
fail to enter running state because the docker driver could not catch
the container name. This commit fixes that by adding a check if podman
docker emulation is used and pick the container hash correctly from the
output.
When buildkit is enabled docker will write out
`writing image <image id>`
When buildkit is not enables docker will write out
`Successfully builld <image id>`
It is more likely that searching for the `writing image` will not
clash with build output than when searching for `Successfully built`.
eg. when installing python packages with pip, it is common to use
the verbage `Successfully built`.
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.
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.
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.
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.
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
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.
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.
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.