Commit Graph

2867 Commits

Author SHA1 Message Date
Chris Roberts 818d1d97ae Update rsync auto post command error handling to be more generic
Rescue and re-wrap any errors encountered when running the post
rsync capability. Rescue this exception type and notify of error
when encountered by rsync auto. Include test coverage.
2018-12-18 09:50:21 -08:00
Chris Roberts 2daafd9586
Merge pull request #10490 from chrisroberts/f-snapshot-behavior
Update behavior of `snapshot restore` and `snapshot pop`
2018-12-13 09:18:20 -08:00
Chris Roberts 480bb47e1d
Merge pull request #10496 from chrisroberts/e-ssh-config-file
Add support for config and remote_user to SSH options
2018-12-13 09:16:49 -08:00
Chris Roberts 19025bb8c3
Merge pull request #10488 from chrisroberts/f-powershell-elevated
Only modify elevated username under specific conditions
2018-12-13 09:14:30 -08:00
Chris Roberts 90a5854684 Fill out ssh options config and remote_user
Include config option within ssh_config command output template. Default
remote_user value to set username value. Include existence check on
provided config value to ensure file is available. Update tests to
include coverage on all changes. Add new options to the docs.
2018-12-11 08:09:43 -08:00
Gavin Williams 87e38a0bed Remove 'config' from ssh.defaults, and instead setup in '.connect' 2018-12-11 07:51:47 -08:00
Gavin Williams 50a569747c Use 'be_falsey' matcher 2018-12-11 07:51:47 -08:00
Gavin Williams 87437317dc Add support for passing ssh config file in via config 2018-12-11 07:51:47 -08:00
Chris Roberts 598d4254be
Merge pull request #10489 from chrisroberts/f-lots-o-smb
Only prepare 10 shares per command to prevent exceeding allowed command size
2018-12-07 16:29:56 -08:00
Brian Cain 2011e213c3
Merge pull request #10485 from briancain/introduce-experimental-feature-flag
Add experimental flag to guard development features
2018-12-07 16:25:10 -08:00
Chris Roberts c999e7c3d4 Update behavior of `snapshot restore` and `snapshot pop`
Both of these commands failed to default the options disabling
the provisioning from ignoring the sentinel file. This resulted
in different behavior than what was seen with the `up` and
`resume` commands which would only provision items with run set
to "always". This defaults the options to proper match the behavior
of `up` and `resume` to be consistent.

This also adds an extra `--no-start` flag to allow users to restore
a snapshot but not start the restored guest immediately.

Fixes #6752
2018-12-07 16:17:44 -08:00
Brian Cain 2783b121f9
Remove VALID_FEATURES constant 2018-12-07 13:52:02 -08:00
Brian Cain accabdd7ca
Warn users about unknown requested experimental features 2018-12-07 13:36:16 -08:00
Brian Cain 01ec72cac2
Introduce a local and global check for enabled experimental features 2018-12-07 13:30:50 -08:00
Chris Roberts 924fb97e8c Only prepare 10 shares per command to prevent exceeding allowed command size
When a large number of shares are defined it may cause the generated
command to exceed the maximum allowed length. To prevent this, only
allow 10 shares to be processed at a time.

Fixes #10483
2018-12-07 12:56:55 -08:00
Chris Roberts 24cd988d39 Only modify elevated username under specific conditions
Elevated commands can fail via winrm under certain conditions like
the machine name being changed. Detect this by checking for a known
exit code combined with known output included within stderr. If found,
attempt to re-execute the command using a machine prefixed username
if possible.
2018-12-07 12:11:17 -08:00
Brian Cain d551738bc7
Allow feature_enabled? to accept symbols 2018-12-07 10:50:34 -08:00
Brian Cain fc4ba7f420
Update to global_enabled? 2018-12-07 10:50:20 -08:00
Brian Cain 1a32930017
Add guard_with method for protecting ruby blocks 2018-12-07 10:28:21 -08:00
Chris Roberts 55a8649963 Adjust requirement on warnings for VirtualBox NIC
The changeset _did_ get included in the 5.2.22 release so adjust
the requirement to only warn on previous versions
2018-12-06 15:40:31 -08:00
Brian Cain 119f82d826
Merge pull request #10479 from briancain/ensure-tmp-dir-cleanup-package-cmd
Fixes #9593: Ensure temp dir for package command is cleaned up
2018-12-06 15:08:18 -08:00
Brian Cain 212f6ce8bb
Add experimental flag to guard development features
This commit introduces a special flag for enabling features that are not
ready for release. It can either be enabled by setting the
`VAGRANT_EXPERIMENTAL` flag to "1", or by setting it to a string of one
or more comma seperated values for specific features. It also adds a
couple of Vagrant developer focused methods for making it easier to
determine if the flag has been enabled, and if so, what features.
2018-12-06 09:03:49 -08:00
Brian Cain 2038f2878c
Merge pull request #10470 from wolfgang42/snapshot-error
snapshot plugin: Raise error for bad subcommand.
2018-12-04 14:32:22 -08:00
Brian Cain 86e2b78997
Fixes #9593: Ensure temp dir for package command is cleaned up
Prior to this commit, the package actions would create a temp dir in
the process of packaging and compressing a Vagrant box. This commit
ensures that the temp dir is removed once the command has completed so
that it doesn't leave around lots of temp directories.
2018-12-04 11:07:53 -08:00
Brian Cain 6531ed0970
Merge pull request #10468 from briancain/raise-error-if-provider-file-missing
Fixes #10432: Validate that provider file exists prior to upload
2018-12-03 15:57:50 -08:00
Brian Cain 5fa3c5866c
Ensure tmp dir for validate is removed once command exits 2018-12-03 14:50:20 -08:00
Wolfgang Faust 4ec092f46d snapshot plugin: Raise error for bad subcommand.
Closes #9773.
2018-12-01 14:44:42 -05:00
Jose Luis Duran 5ab323733f
FreeBSD: Fix rcvar in network_static templates
The rcvar should be `defaultrouter` instead:

https://www.freebsd.org/doc/handbook/network-routing.html
2018-12-01 10:07:40 -02:00
Brian Cain 6d4d9b9304
Fixes #10432: Validate that provider file exists prior to upload
Prior to this commit, Vagrant would attempt to path expand a file that
didn't exist if it was left out of the passed in arguments and no
`--url` was used for external box uploading. This commit fixes that by
adding some additional validation for the passed in box file.
2018-11-30 14:13:45 -08:00
Brian Cain 68dda8f853
Fixes #10224: Clear our registered providers when validating configs with no provider
Prior to this commit, if you went to validate your Vagrantfile and
wanted to ignore the provider, Vagrant would still fail as it checks if
there are any registered providers that are installed and usable. This
commit mocks out all registered providers to bypass that for the
validate command so that Vagrant can just validate the config and ignore
any provider config blocks.
2018-11-30 10:54:16 -08:00
Chris Roberts d589aa9f81 Update default_nic_type implementation within VirtualBox provider
In some cases the E1000 NIC type is the only acceptable value. Since
defaulting causes breakages to existing boxes, leave the default value
as `nil` but check the VirtualBox version in use and print warning to
user if VirtualBox version is vulnerable and E1000 NIC types are
configured for use within defined network adapters.
2018-11-26 15:58:45 -08:00
Chris Roberts f031ec4ce8 Add tests for VirtualBox driver version 6 2018-11-15 11:07:10 -08:00
Chris Roberts c5bc8aba46 Remove existing common tests to shared examples. Add custom import test. 2018-11-15 11:06:30 -08:00
Chris Roberts e86824e098 Move common virtualbox 5 driver tests into shared examples 2018-11-15 11:05:51 -08:00
Chris Roberts efbf99c451
Merge pull request #10409 from chrisroberts/e-vbox-ssh-port-detect
Update VirtualBox driver ssh_port helper
2018-11-13 15:44:15 -08:00
Chris Roberts c7721f619b Update VirtualBox driver ssh_port helper
Be more restrictive when matching the port forward used for
SSH. Allow matching simply on the guest port, but also include
extra matching criteria for cases where multiple results may
be returned.
2018-11-13 15:04:12 -08:00
Brian Cain 608863809a
Merge pull request #10405 from briancain/fixup-inline-windows-trigger-run
Fixes #10393: Only use Shellwords on non-windows hosts
2018-11-13 14:25:27 -08:00
Brian Cain 69b3b44505
Fixes #10393: Only use Shellwords on non-windows hosts
This commit updates how the trigger `run` inline option works by only
applying `Shellwords.split` to the inline command if it is going to be
run on non-Windows hosts. Otherwise pass the inline script directly to
be executed by Powershell.
2018-11-13 13:07:39 -08:00
Chris Roberts 3ebe5b40e3 Add test coverage on new functionality 2018-11-12 15:36:21 -08:00
Brian Cain a698188c12
Merge pull request #10389 from briancain/ssh-keyfile-paths-spaces-windows
FIXES #9870: Allow for windows path spaces with ssh utility
2018-11-12 09:14:01 -08:00
Chris Roberts f2c146d6d7
Merge pull request #10387 from chrisroberts/e-winrm-elevated
Prepend computer name to user when created scheduled tasks
2018-11-09 16:26:03 -08:00
Brian Cain f8bd2b3f82
Add test for private key paths with '%' characters 2018-11-09 10:46:22 -08:00
Brian Cain 80ac5aaf90
Use path as string rather than Pathname 2018-11-09 10:24:58 -08:00
Chris Roberts c8f431cf44 Prepend computer name to user when created scheduled tasks
When running a shell provisioner elevated with winrm a scheduled
task is created to bypass permissions issues. If the name of the
computer has changed this may no longer work. To prevent errors
this PR updates the implementation to fetch the computer name
and prepends it to the username before creating the task.
2018-11-08 14:21:20 -08:00
Chris Roberts d8bbc5ce09 Add support for specifying the default NIC type used for guest adapters
Provides support for defining the NIC type used for any guest adapter
which does not define an adapter type. This is defaulted to "virtio".
2018-11-07 15:53:46 -08:00
Chris Roberts 2808193a1a
Merge pull request #10368 from chrisroberts/f-box-load-meta
Fallback to Vagrantfile configuration when local metadata lookup fails
2018-11-07 10:12:29 -08:00
Brian Cain bcb6bf8acd
Merge pull request #10347 from briancain/add-timeout-for-ssh-info-hyperv
Fixes #10229: Add proper reboot capability for Windows guests
2018-11-06 09:25:36 -08:00
Brian Cain d2b7da065f
Add test for WinRMNotReady exceptions for ready? method 2018-11-05 14:14:50 -08:00
Chris Roberts 1885692f74
Merge pull request #10364 from chrisroberts/e-gem-dep-order
Update ordering of gem sources to ensure proper resolution
2018-11-05 12:50:26 -08:00
Chris Roberts d2d117471a
Merge pull request #10359 from chrisroberts/e-check-limits
Limit automatic box outdated checks to once per hour
2018-11-05 12:46:56 -08:00
Brian Cain 0188d409d4
Add test for windows reboot cap 2018-11-02 16:34:57 -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
Mikhail Zholobov d9d081199c
action/network: Validate IP settings, show human-readable error 2018-11-02 22:29:19 +01:00
Chris Roberts d293e5dc08
Merge pull request #7693 from legal90/network_address
util/network_ip: Simplify #network_address helper
2018-11-02 14:08:49 -07:00
Chris Roberts 648be1369f Fallback to Vagrantfile configuration when local metadata lookup fails
The project local metadata file may contain invalid information to properly
lookup the configured box. This may occur if the file has been moved,
modified, or the backing box has been removed. In those cases, fall back
to the configuration defined in the Vagrantfile to load the box.
2018-11-02 13:59:53 -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 3daf3e532d Update ordering of gem sources to ensure proper resolution
In recent Rubies the first dependency to satisfy the constraint will
be used regardless if higher versions are available in subsequent
sources. Move custom source to start of list when resolving plugins
to provide desired behavior.
2018-11-02 09:14:27 -07:00
Chris Roberts 976320ec06 Limit automatic box outdated checks to once per hour 2018-11-01 09:45:11 -07:00
Brian Cain 6051f3598e
Fixes #10224: Allow validation of config while ignoring provider
This commit adds a new flag to the `vagrant validate` command which
allows users to completely ignore the provider block of a config file.
This is useful for when you are running `vagrant validate` in CI and
don't want to install a valid provider to check the syntax of your
Vagratnfile. When the flag is invoked, a warning will be displayed
saying that the provider block will be ignored and not validated.
2018-10-30 13:37:22 -07:00
Mikhail Zholobov 74de13cae5
util/network_ip: Simplify #network_address helper
Allow to use IPv6 net masks in string notation.
2018-10-28 21:17:43 +01:00
Chris Roberts ca81f9d6cb Prevent exception from raising on hyper-v check 2018-10-24 17:06:47 -07:00
Brian Cain 580bcaebb0
Merge pull request #10311 from briancain/DOCKER-VM-FOLDER-MOUNT
Deterministic host VM synced folder location for Docker provider
2018-10-24 16:19:41 -07:00
Brian Cain a1bb7b837a
Use semicolon over ampersand to separate commands 2018-10-24 15:27:33 -07:00
Brian Cain e8c6916ebc
Restart each interface if systemd-networkd or networkmanager is not used
This commit is a workaround due to how older debian and ubuntu systems
fail to properly restart networking. Instead of relying on the init
scripts or ifup/down tools to restart each interface, this commit
instead restarts each interface individually
2018-10-24 11:34:38 -07:00
Brian Cain 1761e65f26
Fixes #9763 #10300: Fall back on ifdown/ifup tools for network restart
This commit adds some additional logic that falls back to using the
ifdown/ifup tools to restart networking. On Ubuntu 14.04, the init
script was designed to always fail to restart newtorking, so it needs
to use the ifdown/up tools instead. This commit will use the networking
init script as a last resort to restart networking, assuming other
commands haven't broken networking already.

https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1301015
2018-10-23 14:47:12 -07:00
Brian Cain 7c06950e43
Ensure true or false for automount option 2018-10-23 09:00:55 -07:00
Brian Cain 6d0dfb2690
Fixes #10016: Add `automount` flag if specified with synced_folder
This commit adds a new option to virtualbox synced_folders called
`automount`, where if set to true, will supply the `--automount` flag to
virtualbox.
2018-10-22 15:45:32 -07:00
Chris Roberts 8562daf85e Prevent overly verbose output from SSH communicator
If the type of error changes on retry the messages will effectively
spam the user display with alternating messages. Log each message
sent and only re-display each message once within 10 seconds.
2018-10-19 15:18:03 -07:00
Brian Cain 65651178cd
Fixes #9591: Allow for 'default' smb_username if set
Prior to this commit, Vagrant would prompt for smb username and password
every time, even if only smb_username was defined. This commit changes
that by allowing a "default" username from the Vagrantfile, with the
option of overriding it.
2018-10-19 13:26:18 -07:00
Brian Cain e54c9b22ef
Merge pull request #10301 from briancain/debian-fixup-hostname-change
Fixes #9763, #10300: Split out how hostname is set with Debian hosts
2018-10-18 08:57:29 -07:00
Brian Cain 94bb50fa7e
Add test for syncing folders with docker provider 2018-10-17 14:14:27 -07:00
Brian Cain 0c5d55e69c
Fixes #9763, #10300: Split out how hostname is set with Debian hosts
Prior to this commit, the hostname was set with one big bash script and
attempted to determine what tools are available. This commit changes
that by splitting out that tool check on the Vagrant side of things with
the GuestInspection class, and adds back restarting networking to get a
DHCP lease with the change rather than using `dhclient`. This pattern
matches how hostnames are set in the redhat capability.
2018-10-16 12:00:25 -07:00
Brian Cain 42c01f241c
Mark password as sensitive in logs 2018-10-12 09:07:12 -07:00
Brian Cain e8115a4389
Update based on second round of feedback 2018-10-12 09:07:12 -07:00
Brian Cain d8ec19faa8
Fixup: Update vagrant cloud command PR with feedback 2018-10-12 09:07:12 -07:00
Brian Cain 3c45acc35f
Continue if entity already exists with publish command 2018-10-12 09:07:12 -07:00
Brian Cain 83bd592e30
Introduce curl helper and uploader classes
This commit introduces a new uploader class for uploading files and
splits up some commonly used functionality between it and the downloader
class into a curl helper library.
2018-10-12 09:07:10 -07:00
Brian Cain e70b871660
Introduce `cloud` command
This commit adds a new command to Vagrant called `cloud`. It handles any
and all interactions with the external service Vagrant Cloud.
2018-10-12 09:06:00 -07:00
Chris Roberts dd3d6c7cf2 Extend assert retries to allow for slow setup 2018-10-11 13:00:44 -07:00
Brian Cain cb0bd89ae1
Fixes #10289: Create proper tmp dir for ControlPath
Prior to this commit, when creating the ControlPath tmp dir for
socket path, Vagrant would simply rely on `rand(1000)` for making unique
dirs for rsyncing files which could result in collisions. This commit
updates that be properly using `Dir.mktmpdir` with a `vagrant-rsync-`
prefix.
2018-10-11 09:51:03 -07:00
Chris Roberts 1c480880f1 Add test coverage of local rgloader creation 2018-10-10 10:30:30 -07:00
Chris Roberts d7b5922378
Merge pull request #10275 from chrisroberts/e-hyperv-admin
Update Hyper-V admin check
2018-10-09 14:48:13 -07:00
Chris Roberts 93c2f0f497
Merge pull request #10263 from chrisroberts/e-winrm-extensions
Add winrm and upload commands
2018-10-09 14:42:54 -07:00
Chris Roberts 67bb5d2e6c Update Hyper-V admin check 2018-10-08 14:39:40 -07:00
Chris Roberts 412290828b Fix trailing quotes in source path 2018-10-08 14:18:30 -07:00
Brian Cain 5daa25db80
Merge pull request #10267 from briancain/ruby-trigger-option
Fixes #9840: Introduce `ruby` option for trigger
2018-10-08 09:02:17 -07:00
Brian Cain f4d618eb58
Fixes #9840: Introduce `ruby` option for trigger
This commit introduces a new option to the core trigger feature: `ruby`.
It can be defined to run ruby code when the trigger is configured to
fire. If you give the ruby block an env and machine argument, the
defined ruby code can use those variables internally.
2018-10-05 12:53:41 -07:00
Chris Roberts 904a712838 Provide correct RDP information within configuration information
Dynamically generate RDP information when applicable via provider
if supported. When no RDP port is provided ignore RDP in config
and omit from output.
2018-10-04 14:41:10 -07:00
Chris Roberts 64987daf06
Merge pull request #10255 from chrisroberts/e-base-mac-vbox
Allow automatic mac address assignment with virtuabox provider
2018-10-04 13:38:08 -07:00
Chris Roberts 48d358adcb Add winrm and upload commands 2018-10-04 13:26:41 -07:00
Chris Roberts 648e0ddeaa Explicitly define driver version used for tests 2018-10-01 11:51:14 -07:00
Chris Roberts 85dc0ebec9 Allow automatic mac address assignment with virtuabox provider 2018-10-01 11:05:28 -07:00
Brian Cain f6ae328346
Add test for ignore_box_vagrantfile option 2018-09-26 10:31:55 -07:00
Brian Cain 5f56f0c8b1
Merge pull request #10223 from chrisroberts/e-rhel-nmsysd
Update restart logic in redhat change_host_name cap
2018-09-25 13:53:41 -07:00
Brian Cain 58ebd52f99
Add abort option to core triggers
This commit adds a new option `abort`, which when configured, will exit
the Vagrant process completely. If set to `true`, it will exit cleanly
with exit code 0. Otherwise, the exit code can be configured.
2018-09-25 09:40:36 -07:00
Chris Roberts 8fd05fe3c1 Use `command -v` for checks in all inspection helpers. Fix stubs in tests. 2018-09-21 09:19:40 -07:00
Chris Roberts bc217d5e57 Update redhat change host name capability tests for systemd/NetworkManger updates 2018-09-20 16:46:45 -07:00
shotop a12b09b098 add specs around network restart logic 2018-09-20 15:28:37 -07:00
Joe Doss 86ab4533b1 Fix the test to check for systemctl restart NetworkManager.service too. 2018-09-20 15:28:37 -07:00
Brian Cain a4d5ee6ac1
Merge pull request #10215 from briancain/FIX-SALT-PILLAR
Salt pillar configuration on Windows guests
2018-09-20 09:17:32 -07:00