Commit Graph

2841 Commits

Author SHA1 Message Date
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
Oleksiy Protas de6a1794c7
Config, validation and test 2018-09-19 10:24:09 -07:00
Brian Cain c3c7ad4ea2
Merge pull request #10218 from briancain/fix-env-vars-puppet-windows
Fixes #8315: Properly set env variables for puppet provisioner
2018-09-19 09:04:01 -07:00
Brian Cain 5834b1ca70
Merge pull request #10219 from briancain/SMB-PASSWORD-CHARS
Allow special characters in SMB password field
2018-09-19 09:02:08 -07:00
Brian Cain dac78eb626
Add test for identical file paths 2018-09-18 14:15:34 -07:00
Brian Cain 5ebb548be9
Add test for SMB mount_shared_folder function
This commit ensures that the command that adds the smb username and
password properly quotes the password given by the user.
2018-09-18 13:38:57 -07:00
Brian Cain 06b3268b6f
Fixes #8315: Properly set env variables for puppet provisioner
Prior to this commit, the puppet provisioner would not properly set its
environment variables, if any were configured in the Vagrantfile. This
commit separates those properly with semicolons when calling out to
puppet apply.
2018-09-18 10:09:01 -07:00
Brian Cain 96a00ad692
Include test for get_pillar salt function 2018-09-17 14:32:17 -07:00
Chris Roberts 63ae9556c6 Fix typo in spec runner script 2018-09-11 15:07:21 -07:00
Chris Roberts a3c056ef6f
Merge pull request #10199 from chrisroberts/f-multi-vagrantfile-load
Force command to be re-run after installing local plugins
2018-09-11 10:46:32 -07:00
Chris Roberts 798fb81926 Force command to be re-run after installing local plugins
Reloading the Vagrantfile causes issue with multiple evaluations
where users expect single evaluation. Instead of allowing local
plugin installation to happen prior to command execution, force
halt after installation and the command to be re-run. This will
prevent multiple loads of the Vagrantfile within a single run.
2018-09-10 09:59:58 -07:00
Maxim Kostrikin d06cd2f94b
Hardened proc disallow systemd detection
If you have a vagrant box with proc mounted with
proc    /proc    proc    defaults,hidepid=2     0     0
ps output will be limited to owned process
sudo should extend output
2018-09-10 18:13:58 +07:00
Brian Cain 4f42da15de
Merge pull request #10171 from eigengrau/default-template
vagrant init: Support VAGRANT_DEFAULT_TEMPLATE
2018-09-07 11:17:46 -07:00
Brian Cain c589a667ed
Merge pull request #10182 from chrisroberts/f-ssh-config
Check verify_host_key for falsey or :never values when generating ssh config
2018-09-07 10:43:26 -07:00
Robert Schulze 28771674d6 add `Vagrant.version?` helper method
to check Vagrant for a version match without raising an error.
2018-09-07 11:37:30 +02:00
Chris Roberts 147b5c653e Check verify_host_key for falsey or :never values when generating ssh config 2018-09-05 13:44:07 -07:00
Sebastian Reuße 3efdc8960c vagrant init: Support VAGRANT_DEFAULT_TEMPLATE 2018-09-04 10:48:16 +02:00
Chris Roberts 3ace82cc5b Update Vagrant.has_plugin? helper to function prior to plugin loading
Due to the Vagrantfile being loaded prior to plugin loading to determine
project local plugin information the Vagrant.has_plugin? helper will always
return false when the Vagrantfile is first loaded. To prevent this behavior
we can check for plugins in the plugin data files prior to the plugins
being loaded, and after they have been loaded we can fallback to the
original specification based check.
2018-08-31 14:03:42 -07:00
Brian Cain 11c619bff6
Merge pull request #10092 from jmaness/patch-1
[#10098] Filter out empty strings and loopback interfaces when constructing the list of network interfaces
2018-08-31 10:03:49 -07:00
Chris Roberts a5177f506d
Merge pull request #10156 from chrisroberts/f-smb-list-parse
Extract smblist information based on position
2018-08-30 11:32:45 -07:00
Chris Roberts e24728cb5a
Merge pull request #10155 from chrisroberts/f-plugin-load-config
Reset internal environment after plugin load
2018-08-30 11:30:14 -07:00
Chris Roberts c4084a6387 Extract smblist information based on position
Since we are no longer extracting information based on key value due
to localization issues, use start and end locations to extract data.
This prevents errors when extra information is included like Scope.
2018-08-30 10:58:56 -07:00
Chris Roberts 9b67655e45 Reset internal environment after plugin load
Force the vagrantfile and configuration loader to be rebuilt after
plugins have been loaded to properly allow newly introduced plugin
configurations to be properly supported within the Vagrantfile.
2018-08-30 10:44:09 -07:00
Chris Roberts 92109752a3 Fix local plugin prompt and add coverage 2018-08-30 10:35:16 -07:00
Chris Roberts d48b95ffaf Check :verify_host_key value for :never or if falsey 2018-08-24 14:11:30 -07:00
Brian Cain 6a57ae74a8
Merge pull request #10118 from briancain/TRIGGER-SPACE-PATH
Allow for spaces in `path` for trigger run option
2018-08-17 15:29:07 -07:00
Brian Cain b1357a2f60
Merge pull request #10123 from briancain/add-force-flag-reload
Add `--force` flag to reload command
2018-08-17 15:18:36 -07:00