Commit Graph

206 Commits

Author SHA1 Message Date
Chris Roberts 0bce1e6307 Update tests for checksum and filechecksum 2019-10-08 11:23:48 -07:00
Chris Roberts 7fb81bcea1 Add support for other checksum types 2019-10-08 11:23:48 -07:00
Brian Cain 0a6c4e2d0f
Ensure relative path for file provisioner is relative to machines cwd
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.
2019-10-02 15:33:23 -07:00
Brian Cain 96c20ad3cc
Fixes #10950: Ensure pip_install_cmd is finalized
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.
2019-10-02 10:33:31 -07:00
Brian Cain d55f8d3496
Fixes #10912: Update chef install check for guests
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.
2019-06-17 11:02:57 -07:00
Brian Cain 139ae4397f
Merge pull request #10625 from vdebroy/fix-issue-9584
Fix issue 9584
2019-04-09 15:12:02 -07:00
Chris Roberts 6b105d704d Update communicator upload behavior to handle `/.` path directives
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
2019-02-26 08:02:09 -08:00
Vidroha Debroy 7c0ffe369a Updated based on recommended changes per review. 2019-02-15 12:14:37 -06:00
Vidroha Debroy 281203edf1 Handling the cases for UNSET_VALUE, i.e., config is not finalized. 2019-01-28 13:35:50 -06:00
Vidroha Debroy d2c11e81ae Config has pip_install_cmd for Provisioner to pick it up. Tests updated. 2019-01-25 16:51:58 -06:00
Vidroha Debroy 84df098135 Handling empty strings passed as pip_install_command. 2019-01-25 14:55:39 -06:00
Vidroha Debroy 2b0617fb64 Adding pip_install_cmd as a default parameter to get_pip. Unit Tests. 2019-01-25 13:59:15 -06:00
Chris Roberts 1f959e03cb
Merge pull request #10532 from chrisroberts/e-reboot
Add reboot option to shell provisioner
2019-01-03 13:52:19 -08:00
John Landis bd6fa11281
Disabled salt provision required install_type check on Windows where option is not supported. Added test case for salt provisioner config changes. 2018-12-23 11:39:58 -05:00
Chris Roberts e735453422 Add reboot option to shell provisioner
Adds a `reboot` option which allows the guest to be rebooted after
the completion of a shell provisioning task. The guest must support
the `:reboot` capability. Like the `reset` option, the `reboot`
option may be provided without defining `inline` or `file` options
when a reboot may be required between other provisioners.

Fixes #8639
2018-12-21 15:50:59 -08:00
Chris Roberts 3ebe5b40e3 Add test coverage on new functionality 2018-11-12 15:36:21 -08: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
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 7df6ea5a30 Fix Chef apply provisioner to not set node_name
The base chef provisioner class will set the node name automatically
if not provided in the configuration. Since the chef apply provisioner
does not provide a node_name option, setting it will invalidate the
configuration. This checks for the node name before attempting to
use it.

Fixes #9901
2018-06-11 10:35:52 -07:00
Alexander Fischer 0b87184ad4
#9174 Remove masterless? config attribute
Remove the @config.masterless? attribute as there is no benefit from it
2018-05-11 08:49:57 +02:00
Chris Roberts 8b398b66a3 Trim drive letter prefix from path
Fixes #9764
2018-05-03 09:28:19 -07:00
Brian Cain 7f004656db
(#9718) Properly finalize structured_facts config option
This commit sets the structured_facts option to nil if its still
UNSET_VALUE at the finalize step. This was causing a bug when the facter
config was set but was not using structured facts.
2018-04-23 14:23:59 -07:00
Brian Cain 9660951c89
Merge pull request #9490 from jzinn/solo-rb-cookbook-path
Improve Windows drive letter removal hack
2018-04-18 08:31:23 -07:00
Julian Zinn 269645f63d Improve Windows drive letter removal hack 2018-04-17 13:23:14 -07:00
Brian Cain 151095a3e9
Merge pull request #9420 from ryanwalder/salt-json
Add master_json_config & minion_json_config options to salt provisioner
2018-04-16 15:37:44 -07:00
Brian Cain 1a03fe687b
Update rspec tests for puppet provisioner 2018-04-09 11:03:30 -07:00
Josh Soref 1a5ddea9f4 Spelling fixes
* account
* addresses
* administrator
* afterwards
* because
* bridgeable
* capabilities
* capability
* checksum
* configuration
* configuration for
* configure
* criteria
* delimited
* delivered
* derivatives
* description
* detect
* directory
* display
* downloading
* during
* electric
* enabling
* encountered
* equivalent
* executable
* executed
* hashicorp
* hypervisor
* hyphens
* implementation
* incorporate
* inheritance
* initialize
* instance
* instead
* interactions
* invocable
* machine
* maximum
* message
* mounting
* overridden
* overwrite
* paramiko
* preparing
* provides
* provisioning
* recursively
* requested
* resetting
* retryable
* running
* satisfied
* searching
* sometimes
* specified
* successfully
* synced folders
* unauthorized
* underlying
* userprofile
* vagrant
* vagrantfile
* variable
* various
* version
* virtual
* windows
2018-03-14 14:41:04 +00:00
Ryan Walder db457e6318 Add master_json_config & minion_json_config options to salt provisioner
* Allow use of -j/-J bootstrap options for configuring master/minion
2018-01-31 12:28:36 +00:00
Chris Roberts 3664f1a627 Allow hiding environment variable values in shell provisioner 2018-01-12 17:33:47 -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
Vít Ondruch 7187e6f909 Use Integer instead of Fixnum for Ruby 2.4+ compatibility. 2017-10-23 10:57:36 -07: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
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
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
Brian Cain 089117bc0f Merge pull request #8939 from briancain/8933/master/source-path-file-prov
Align file provisioner functionality on all platforms
2017-09-05 15:54:52 -07:00
Gilles Cornu b741ff7999
provisoners/ansible(both): Accept 'all:vars'
The patterns "all" is a special keyword that target all hosts in the
inventory. Therefore it makes sense to accept "all:vars" as a group
variable name. Note that "*:vars" pattern is not valid in an Ansible
inventory.
See http://docs.ansible.com/ansible/latest/intro_patterns.html#patterns

Fix #7730
2017-09-03 18:41:06 +02:00
Brian Cain a9564b2137 (#8933) Align file provisioner functionality on all platforms
This commit aligns how the file provisioner should work on all host
machines. It ensures that a `/.` is only applied if the user intended
to upload a folder to a destination under a different name. It ensures
that if uploading to a windows guest with a different destination folder
name, it does not nest the source folder under that name so that it
works the same as it does on linux platforms. It also updates the
behavior of the winrm upload communicator by allowing an array of paths
to be uploaded instead of a single file or folder to allow for this new
functionality for windows guests.
2017-08-31 15:57:53 -07:00
Brian Cain 432cb8d915 (#7826) Add salt_arg option for passing flags to salt tool
This commit introduces the salt_arg option that allows a user to pass
additional command line flags to the `salt` tool when provisioning with
a master setup.

It also adds additional config validation to ensure that both
`salt_args` and `salt_call_args` is an array.
2017-08-29 14:11:06 -07:00