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.
The Ansible package in FreeBSD is now `py36-ansible`.
If `pkg` itself needs updating, passing only one 'yes' is not enough to
confirm the installation of the package. Use the `-y` option,
specifically made for this purpose. Also add `-q` to force a quiet
output, inline with other guests.
References:
- [`pkg-install(8)`](https://www.freebsd.org/cgi/man.cgi?query=pkg-install&sektion=8)
- freebsd/freebsd-ports@cbf5576945
- By the way: Trim the generate 'pip install' command in Ansible::Cap::Guest::Pip::pip_install
- GH-11048: Fix same regression for FreeBSD and SuSE guests.
- GH-6633: Add RSpec examples to cover ansible_local 'cap' code.
Note: RedHat/Fedora guests are not covered yet by unit tests.
Sets `DEBIAN_FRONTEND=noninteractive` and tells `dpkg` to take the old
version of config files when installing Ansible, to prevent hangs
waiting for user input.
Fixes#10914
Prior to this commit, if you ran Vagrant in a different current working
directory other than where a current guest machines location is, the
file provisioner would not take into account the machines local dir, and
would instead use the path where Vagrant was invoked to expand the
`source` path option for a file provisioner. This commit fixes that by
passing the root path `machine.env.cwd` when expanding the source dir.
Prior to this commit, the `pip_install_cmd` option for ansible guest
config was not properly finalized. This commit ensures that if that
value is still UNSET_VALUE, it gets set to empty string in the finalize!
method.
Prior to this commit, the chef_installed capability was looking for a
string that has recently changed in newer versions of chef. This commit
fixes that by instead just looking for the right version that was
configured for the chef client, rather than the specific string that
could change again in the future.
This update was prompted by updates in openssh to the scp behavior
making source directory paths suffixed with `.` no longer valid
resulting in errors on upload. The upload implementation within
the ssh communicator has been updated to retain the existing
behavior.
Included in this update is modifications to the winrm communicator
so the upload functionality matches that of the ssh communicator
respecting the trailing `.` behavior on source paths. With the
communicators updated to properly handle the paths, the file
provisioner was also updated to simply apply previously defined
path update rules only.
Fixes#10675
Prior to this commit, Vagrants output would only show that a file
provisioner was running, but had no detail as to what file was being
copied to where. This is especially confusing if a Vagrantfile has
multiple file provisioners. This commit updates that by showing the
source and destination of the file so that it's clearer what is being
copied and to where.