Commit Graph

1472 Commits

Author SHA1 Message Date
Chris Roberts e85ef1655b Always remove credentials file after mount attempts 2017-12-21 09:55:19 -08:00
Brian Cain b9581ed213
Merge pull request #9251 from briancain/9137/master/exit-0-destroy-not-created
Exit 0 if vagrant destroy finds no running vms
2017-12-20 16:42:36 -08:00
Brian Cain 0d7ad9f18f
Merge pull request #9275 from zachflower/validate_ip_addresses
Add a clean error message for invalid IP addresses
2017-12-15 11:22:03 -08:00
Chris Roberts 6223afcfa6
Merge pull request #9276 from chrisroberts/e-scrub
Scrub sensitive information prior to message output
2017-12-15 09:55:18 -08:00
Brian Cain 144c402f3b
Merge pull request #9252 from briancain/9055/master/pretty-print-nameerror-exceptions
Print more helpful error message for NameEror exceptions
2017-12-15 09:19:26 -08:00
Chris Roberts 6f663edad0 Scrub sensitive information prior to message output
This provides a simple wrapper around all output to
scrub any strings that have been registered as sensitive
before being output. Also included is a small change
to the initial debug output to only show vagrant specific
environment variables and not the full user environment.
2017-12-14 15:38:31 -08:00
Brian Cain 627babe15e (#9055) Print more helpful error message for NameEror exceptions
This commit adds some additional handling for when Vagrant loads config
files. Instead of showing the basic ruby exception, it prints a more
helpful error message and tries to direct the user to the line number
and file where the exception is occuring.
2017-12-14 15:31:48 -08:00
Zachary Flower 0f4c06f7ba add unit tests to validate 2017-12-14 15:25:24 -07:00
Brian Cain d4d4ed6473 (#9137) Exit 0 if vagrant destroy finds no running vms
This commit reverts the behavior of `vagrant destroy` to exit 0 if no
running vms were found when the destroy command is run.
2017-12-14 12:48:22 -08:00
Gilles Cornu 43bcf2aaf7
Merge pull request #9173 from hashicorp/gildegoma/fix-ansible-ask-sudo-pass-deprecation
Ansible Provisioner: Fix broken 'ask_sudo_pass' option
2017-12-14 21:46:23 +01:00
Zachary Flower abb1149190 Raise an exception when the template cannot be found, and update tests accordingly 2017-11-17 12:20:03 -07:00
Zachary Flower 968fbb2399 Update `init` command unit tests to reflect new --template option 2017-11-17 12:02:23 -07:00
Justin Campbell f1863a8243
Merge pull request #9145 from hashicorp/login-middleware-auth-hosts
Add app.vagrantup.com to allowed auth hosts
2017-11-15 14:17:55 -05:00
Brian Cain 401f1d521e
Merge pull request #9131 from bpietraga/fix-outputh-pathname-folder-creation
Fix --output path with specified folder
2017-11-15 09:55:32 -08:00
Gilles Cornu 8333090d1d
ansible: Refuse to run unit tests with an invalid config
With this change, a bug like #9173 can be detected.
2017-11-10 20:40:13 +01:00
Gilles Cornu e47deb7fd0
ansible: Fix broken 'ask_sudo_pass' option
This bug (invalid method call) hasn't been caught by unit tests because
Vagrant::Plugin::V2::Config catches all invalid/bad configuration calls
and save them for generating error messages during the "validate" stage.
This way, the `ask_sudo_pass=(value)` method was not interrupted and the
`@ask_become_pass` attribute was (surprisingly) correctly set (allowing
the related unit tests to pass).

In order to avoid similar problem to happen again, the deprecation
message output is now fully verified.
2017-11-09 18:17:04 +01:00
Justin Campbell 40d8dc4582 Add app.vagrantup.com to allowed auth hosts
This should allow users setting VAGRANT_SERVER_URL to app.vagrantup.com to authenticate to private boxes.
2017-11-07 10:35:16 -05:00
Bernard Pietraga b026be7cb3 Fix --output path with specified folder 2017-11-04 12:00:55 +01:00
Brian Cain 228bd95257
Merge pull request #9127 from briancain/parallel-destroy-flag
Introduce parallel destroy for certain providers
2017-11-02 14:04:03 -07:00
Chris Roberts 9c2c83d781
Merge pull request #9135 from chrisroberts/e-ca-bundle
Use environment variable for CURL_CA_BUNDLE
2017-11-02 13:58:11 -07:00
Chris Roberts 06e3185eb1 Use `CURL_CA_BUNDLE` environment variable inplace of building path at runtime 2017-11-02 12:49:34 -07:00
Brian Cain 8be2ae8e6a Add unit test for destroy command 2017-11-01 15:30:59 -07:00
Chris Roberts d422053fbc Check for vagrant.exe path before validating versions 2017-10-24 16:53:53 -07:00
Brian Cain 337b200d30 Update rspec tests to remove deprecation warnings 2017-10-24 12:08:38 -07:00
Chris Roberts eaa518159c Merge pull request #8997 from bshurts/fix/winrm-apipa
Adding check for APIPA in winrm helper to fix #8996
2017-10-23 16:47:32 -07:00
Vít Ondruch 7187e6f909 Use Integer instead of Fixnum for Ruby 2.4+ compatibility. 2017-10-23 10:57:36 -07:00
Brian Cain a849cd2f7d (#8963) Unify Solaris Guests
This commit removes some duplicated code within the Solaris11 guest
implemnentation and instead relies on the Solaris guest for the majority
of its guest capabilities.
2017-10-05 11:31:12 -07:00
Chris Roberts 32a4b73dd4 Enable documentation formatter on rspec 2017-10-05 10:17:30 -07:00
Bryce Shurts 927f653437 Adding tests for winrm_info_invalid 2017-10-05 10:28:25 -05:00
Jonathan LaBroad 73349d6ed6 Whitespace 2017-10-05 07:40:54 -04:00
Jonathan LaBroad 64f8d91888 Add slightly more clarity in test case 2017-10-05 07:33:57 -04:00
Jonathan LaBroad 79365f3789 Test that linux flags don't get passed to Windows Salt minion bootstrap 2017-10-05 06:55:53 -04:00
Jonathan LaBroad 56861296fa Added tests and validation for python_version parameter 2017-10-05 06:25:36 -04:00
Brian Cain 87ee4f5662 Merge pull request #8995 from elatt/fix_synced_folders_spaces
Allow synced folders to contain spaces in the guest path
2017-09-29 15:19:39 -07:00
Erik Lattimore 28a92850ab Allow synced folders to contain spaces in the guest path
It should be valid to allow paths with spaces for the synced folder
guest path but since the guest path is used to generate the ID (if one
isn't provided), this will err out in VirtualBox because it doesn't
allow spaces for the --name argument. We should simply convert ' ' to
'_' as we do with other special characters.
2017-09-29 17:24:12 -04:00
Bryce Shurts 0eaf691ea0 Adding check for APIPA in winrm helper to fix #8996 2017-09-25 16:31:37 -05:00
Brian Cain 3c9e1c9d84 (#8954) Split out cygwin path and ensure bin exists
This commit splits out the msys2 and cygwin path functions for
expanding a path with the cygpath tool. It also ensures that the tool
itself exists when the Which class is called so that it doesn't attempt
to escape slashes on nil.
2017-09-15 10:33:04 -07:00
Chris Roberts 2451c859e8 Merge pull request #8746 from mastersin/alt
Add ALT Linux platforms guest detection and network configuration support (#8745)
2017-09-06 17:49:38 -07:00
Chris Roberts d7b64dce80 Merge pull request #8938 from chrisroberts/update/host-systemd
Update linux host NFS capability
2017-09-06 16:57:27 -07:00
Chris Roberts 34addec796 Merge pull request #8913 from mitchellh/gildegoma/6570-ansible-compatibility-mode
Ansible: Add "compatibility_mode" and "*become*" common options; Move "version" to common options
2017-09-06 13:18:08 -07:00
Gilles Cornu ac75e409a3
provisioners/ansible(both): Quote host_vars if needed
This patch is based on @subimage's inputs in the related GitHub issue.
Thanks again!

Fix #8597
2017-09-06 21:22:41 +02:00
Chris Roberts fcd1aee9bb Update linux host NFS capability
Add support for systemd detection and using correct method
for starting/checking host nfs service.
2017-09-06 09:54:06 -07:00
Brian Cain f1eddace18 Merge pull request #8945 from briancain/4666/master/dupe-nfs-export-linux
Remove duplicate export folders before writing /etc/exports
2017-09-06 08:34:46 -07:00
Gilles Cornu dc3b6341e2
provisioners/ansible: Check compatibility conflicts
Vagrant will verify that the current Ansible version does support the
requested compatibility mode (only applicable if not "auto", of course).

As mentioned in the documentation, there is no sanity checks between
`version` option and `compatibility_mode` option.

With this change, the host-based provisioner is also improved to
execute only once the "ansible" command (and store the gathered
information for multiple usages like version requirement and
compatibility checks). On the other hand, the guest-based provisioner
can still potentially execute "ansible" twice (once in the
AnsibleInstalled cap, and via "gather_ansible_version" function via
Base::set_compatibility_mode).
2017-09-06 17:12:40 +02:00
Gilles Cornu 71dd393134
unit/tests: Remove a TODO comment
This was pushed by accident in 073898046542323eb11c2e129f37fa558ae201e1.
2017-09-06 17:12:37 +02:00
Gilles Cornu 8c0df3d046
provisioners/ansible: Move `version` to common options
Before this change, only the ansible_local provisioner supported this
option (for ansible version requirement, and pip installation). Now, the
ansible host-based provisioner can also require a exact ansible version.

Resolve #8914

Note: this has been added as part of #6570 resolution, since the
introduction of the `compatibility_mode` auto-detection made both
provisioners made capable to detect ansible version.

Pending: optimize the code to avoid duplicated executions of "ansible
--version" command.
2017-09-06 17:12:35 +02:00
Gilles Cornu 15e74e264d
provisioners/ansible: Fix test stubs
Make the stubbed valid and invalid Ansible versions closer to the real
"ansible --version" stdout output.
2017-09-06 17:12:33 +02:00
Gilles Cornu a327e34861
provisioners/ansible: Validate compatibility_mode
- Use `'auto'` instead of `nil` for the auto-detection mode
- Add strict validation and related error message
2017-09-06 17:12:32 +02:00
Gilles Cornu 8834afbd8e
provisioners/ansible(both): Add compatibility mode
With this change, it is now possible to get rid of many deprecation
messages successively introduced in Ansible 1.9, and 2.0. More
interesting, the generated inventory will contain the recommended
variable names (e.g. `ansible_host` instead of `ansible_ssh_host`)
when the compatibility mode is set to '2.0'.

Details:

- Add `compatibility_mode` option to control the Ansible parameters
  format to be used. The value corresponds to the minimal version
  supported. For the moment, possible values are '1.8' (corresponding to
  Vagrant's former behaviour) or '2.0'.
  Note that a dynamic inventory generated in compatibility mode '2.0'
  is not supported by Ansible 1.x. On the other hand, Ansible 2.x so far
  supports inventory format generated by the compatibility mode '1.8'.

- Add compatibility mode auto-detection, based on the available Ansible
  version. This is the default behaviour in order to bring a maximum of
  user friendliness. The drawback of this approach is to let potential
  compatibility breaking risks, for `ansible` provisioner setups that
  already integrate Ansible 2.x **AND** rely on the existence of
  the generated `_ssh` variable names. Thanks to the vagrant warnings
  (and its release notes), I argue that it is worth to offer
  auto-detection by default, which offers a sweet transition to most
  users.

- Add `become`, `become_user` and `ask_become_pass` options and their
  backwards compatible aliases. The legacy options are now deprecated.

Note that we intentionally didn't provide a '1.9' compatibility mode,
as it would add extra-complexity for practically no added-value.
To my knowledge, the Ansible 2.x series haven't introduced yet any major
changes or deprecations that would motivate to introduce a higher
version compatibility mode (to be confirmed/verified).

Resolve GH-6570

Still Pending:

- Optimization: Reduce the number of `ansible` command executions.
  Currently two exec calls will be performed when the compatibility
  mode auto-detection is enabled (i.e. by default). We could make the
  provisioner a little bit smarter to only execute `ansible` only once
  in any situation (by combining "presence" and "version" checks).

- User-friendliness: Add better validator on `compatibility_mode`
  option, and shows a warning or an error instead of the silent
  fallback on the auto-detection modus.

- Test coverage: All the added behaviours are not fully covered yet.
2017-09-06 17:12:22 +02:00
Gilles Cornu e09848ca59
provisioners/ansible_local: Shellescape extra-vars
Fix #7735

Further work for proper shell-escaping of other ansible-playbook and
ansible-galaxy command line arguments will be addressed via #8949.
2017-09-06 16:30:40 +02:00