Commit Graph

2544 Commits

Author SHA1 Message Date
Chris Roberts 3f8172d874 Merge pull request #8618 from jen20/smartos-guests
guests/smartos: Add/fix various guest capabilities
2017-06-14 16:33:46 -07:00
Brian Cain 3baa142e7c (#7685) Add a unique identifier to provision objects
Prior to this commit, Vagrant had no way internally to determine if a
provisioner object was unique if the `name` property was not set.
Because of this, when vagrant went to merge configs it would duplicate
an existing unnamed provisioner since it had no way of determining if a
user actually had added the same provisioner twice. This commit fixes
that by introducing an id which will default to `name` if its set, but
if not will be set by `SecureRandom.uuid`.
2017-06-13 15:46:14 -07:00
Brian Cain 6f21a19649 Merge pull request #8661 from briancain/6640/master/use-cipher-list-for-ssh-communicator
Use default cipher list for ssh communicator
2017-06-12 09:39:20 -07:00
Brian Cain 7a97f0a53e (#6640) Use default cipher list for ssh communicator
Prior to this commit, the ssh communicator would use the default cipher
list in Net::SSH to negociate which ciphers it should use between hosts.
Due to a bug in Net::SSH and the position of the `none` cipher in its
default cipher list, if a host supported the none cipher, but also
only supported other ciphers that came after none in the default list,
it would accept none and attempt to use that cipher instead of the other
supported ciphers. This commit fixes that behavior by copying the
default cipher list from Net::SSH and placing none last in the list so
that other ciphers can be used in the negotiation before attempting to
use the unsecure none cipher.
2017-06-09 17:18:15 -07:00
Brian Cain 378aae8782 Merge pull request #8653 from briancain/7188/master/unify-snapshot-restore-failures
Clean up vagrant snapshot restore/delete error messages
2017-06-07 11:47:38 -07:00
Brian Cain 43ae30cf9b Merge pull request #8651 from briancain/WARN-CWD-CHANGES
Warn about changes to cwd for every machine action
2017-06-07 11:46:57 -07:00
Brian Cain 87b7514603 (#7188) Clean up vagrant snapshot restore/delete error messages
This commit adds some better handling around the snapshot restore and
delete commands for the virtualbox provider. If a user attempts to restore from
a vm that does not exist, instead of exiting 0 it will raise an
exception saying the virtual machine has not been created yet.
Addtionally, if a user attempts to restore from a snapshot id that does
not exist, instead of printing a complicated exception from the
virtualbox cli tool, it prints a more useful error message telling the
user that the snapshot does not exist.
2017-06-07 09:12:20 -07:00
Brian Cain 79c7799fd9 Add basic unit test for CWD change warning 2017-06-06 08:38:03 -07:00
Fernando Seror 48b0e00368 Tests regarding warning whenever CWD changes 2017-06-05 13:25:30 -07:00
Brian Cain 1ade699936 (#6827) Introduce tty flag for ssh command execution
Prior to this commit, if a user ran the `vagrant ssh -c CMD` command, it
would not allow the user to configure pseudo-terminal allocation. This
commit introduces a -t flag for the `vagrant ssh` command which defaults
to true if not specified.
2017-06-02 17:32:02 -07:00
Brian Cain d0f1f39fa6 Merge pull request #8636 from briancain/7118/master/handle-invalid-box-names
Handle box names that are URLs
2017-05-31 16:16:38 -07:00
Brian Cain f1d08aa629 (#7118) Handle box names that are URLs
Prior to this commit, if a user set a URL for the name of a box, vagrant
would not warn the user about using box_url instead. This would lead to
some difficult user experiences around the various box commands due to
the box name being a full URL. This commit introduces a warning to the
user and lets them know to instead use box_url.
2017-05-31 15:25:05 -07:00
Brian Cain b349d664e4 Include snapshot list unit test
This commit introduces a new set of unit tests for the snapshot list
command.
2017-05-30 15:19:58 -07:00
James Nugent b84acaed3c guests/smartos: Add/fix various guest capabilities
This commit adds/changes the following for SmartOS guests:

- modifies the "Halt" capability to use /usr/sbin/poweroff in preference
  to /usr/sbin/shutdown with parameters, and modifies the associated
  test.

- adds an "InsertPublicKey" capability and tests.

- adds a "RemovePublicKey" capability and tests.

With this commit applied, the vast majority of typical Vagrant workflow
is available to SmartOS global zone guests (provided NFS mounts are used
rather than VMWare shared folders).
2017-05-30 15:18:18 +01:00
Brian Cain eadb0ac831 Raise exception if provider doesn't have snapshot capability
Prior to this commit, if a user attempted to use the `vagrant snapshot
save` or `vagrant snapshot list` commands on a vm whose provider did not
support snapshots, it would simply print a warning. This commit changes
that behavior by instead raising an error.
2017-05-26 15:22:25 -07:00
Brian Cain 6ddba4f7b3 (#7810) Enforce unique snapshot names
Prior to this commit, the vagrant snapshot plugin would save snapshots
with existing names which lead to duplicate snapshot names being saved.
This commit fixes that by checking to see if the given snapshot name
already exists and if so, fails telling the user the given snapshot name
already exists. If a user passes a --force flag, vagrant will first
delete the existing snapshot, and take a new one with the given name.
2017-05-25 16:28:17 -07:00
Tim Aslat 7f675d723c Update unit test to match fix 2017-05-18 16:06:27 +09:30
Chris Roberts 3e05ac0639 Stub out the which check within compose tests 2017-05-15 09:09:25 -07:00
Chris Roberts ed1b25f1b2 Include spec coverage on compose driver 2017-05-12 15:09:30 -07:00
Chris Roberts 2f5e15da55 Fetch first network device and pass to template for rendering 2017-05-10 12:44:37 -07:00
Chris Roberts c3ba13cd4d Update capability tests to remove nmcli reload matching 2017-05-10 10:25:55 -07:00
Aron Griffis 3ec1f4e045
Add new tests for VAGRANT_PREFERRED_PROVIDERS 2017-05-03 08:19:29 -04:00
Chris Roberts 1df852c88a Reduce commands. Allow nm reload/restart to bring interfaces up.
Reduce the total number of commands run to configure interfaces. If
a service reload/restart is required, only execute it once instead
of once per device. When nm is managing a device, the explicit up
is not required.
2017-05-01 13:17:17 -07:00
Chris Roberts 414184b76b guests/rhel: Update network configuration
Properly detects NetworkManager on guest as well as devices controlled
by NetworkManager. Provides configuration option to enable/disbale
NetworkManager control on devices.
2017-04-26 13:15:33 -07:00
Chris Roberts a8b2f78f59 Do not prefix Windows paths if UNC prefix already exists
While VirtualBox has commented that they do not support UNC remote
paths (but do for long paths) it seems that remote paths can work.
If user provides UNC path, allow it to be used as-is.

Fixes #7011
2017-04-20 16:33:38 -07:00
Chris Roberts 82ca8f8058 Support port checker methods which only accept the host port
When calling the port_checker an arity check is done to determine
if the helper accepts the host_ip and host_port or only the host_port.

Fixes #8423
2017-04-19 10:49:27 -07:00
Chris Roberts 067a0a5d0d communicator/ssh: Do not pass empty data to registered blocks
Prevent sending empty data strings to defined blocks handling
stderr and stdout output. These can occur when the garbage
marker is identified and collected data pruned, but no remaining
data is left to send.

Fixes #8259
2017-04-18 13:33:19 -07:00
Chris Roberts 232a44f46d Merge pull request #8485 from chrisroberts/communicators/win-ssh
Add winssh communicator
2017-04-17 08:21:33 -07:00
Chris Roberts e52821364a Merge pull request #8407 from gh2k/gentoo-systemd
Add support for gentoo guests that use systemd
2017-04-16 14:17:19 -07:00
Chris Roberts 38a5f7c873 Merge pull request #8310 from tsmolka/patch-guest-esxi
guests/esxi: Added public_key capability
2017-04-16 08:13:26 -07:00
Chris Roberts c56acfab94 Add WinSSH communicator 2017-04-15 07:12:58 -07:00
Martin Nowak 1ca247f516 fix `config.ssh.keys_only = false` for ansible
Also see #5017.
2017-04-12 12:31:00 +02:00
Chris Roberts 21e195c75a Merge pull request #7425 from tjuerge/6220-mount_shared_folder-via-ssh
Add support for mounting synched folders on windows guest via ssh
2017-04-05 15:11:32 -07:00
Chris Roberts 4af1fbccfb Merge pull request #8410 from chrisroberts/fix/smb-mount
Fix linux guest mount smb capability
2017-03-27 09:07:22 -07:00
Chris Roberts 98b0ad1464 Fix linux guest mount smb capability 2017-03-24 13:42:51 -07:00
Gilles Cornu 80d105cf8c
ansible_local: Add the :pip_args_only install mode
With the introduction of `pip_args` option, you can easily extend the
`:pip` installation mode behaviour. But some interesting/advanced usages
are still not possible because of the auto-generated parts ("ansible"
package, version selection, and the `--upgrade` flag).

By adding this "pip_args_only" install mode, it will be for instance
possible to:
- install unofficial releases, like release candidates published at
  https://releases.ansible.com/
- install more pip packages (e.g. via a `requirements.txt` file), with
  hash validation, etc.

Note that there is no config validation that requires `pip_args` option
to be defined when the :pip_args_only mode is selected. This would be
more elegant, and user friendly to raise a configuration error, but this
can wait. At least, running with an empty `pip_args` won't lead to any
command crash, since the rather dummy "pip install" shows an helper
notice and terminates with a zero (0) exit code.

This change is thought as a complement to the changes originally
proposed in pull request GH-8170.
2017-03-24 17:35:34 +01:00
Simon Detheridge 3a3216ae0c gentoo/guest: #8406 support systemd when configuring net 2017-03-24 16:11:16 +00:00
James Carr 7e2e5654ed
ansible_local: Add `pip_args` option
With this new option, it is now possible to pass additional arguments to
pip command when the `install_mode` is "pip".

(@gildegoma reworded the original commit message of pull request GH-8170)
2017-03-24 00:01:14 +01:00
Chris Roberts 256ce3b0d5 Merge pull request #8264 from hasyimibhar/command-validate
Add validate command
2017-03-23 09:52:12 -07:00
Chris Roberts 052ff53642 Merge pull request #8399 from chrisroberts/fix/port-check
Use 127.0.0.1 for host IP when unset and 0.0.0.0 is not available
2017-03-23 09:37:33 -07:00
Chris Roberts e7abd1114b Merge pull request #8393 from chrisroberts/fix/default-provider-env-var
Prevent other provider install attempts when explicit provider given
2017-03-23 09:35:59 -07:00
Chris Roberts 21b7214668 Merge pull request #8336 from chrisroberts/networking/overhaul
Remove hardcoded interface name from template
2017-03-23 09:10:01 -07:00
Chris Roberts 5cd95b684f Use 127.0.0.1 for host IP when unset and 0.0.0.0 is not available 2017-03-22 16:31:46 -07:00
Chris Roberts 72d0eb497d Isolate push deprecation to atlas strategy only 2017-03-21 15:08:17 -07:00
Chris Roberts 7c4252e24a Prevent other provider install attempts when explicit provider given 2017-03-21 10:58:06 -07:00
Chris Roberts 99942f888f Merge pull request #8366 from chrisroberts/fix/never-provision
Fix provision action for provisioners set to never.
2017-03-17 14:31:03 -07:00
Chris Roberts 7be5266e20 Add spec support scripts for centos 2017-03-17 14:18:14 -07:00
Chris Roberts e7ecfa8109 Use guest boxes variable, not constant. Remove option value quotes. 2017-03-15 11:02:31 -07:00
Chris Roberts ce2a1ac634 Adjustable host memory. Allow custom command arguments. 2017-03-15 09:30:57 -07:00
Chris Roberts eed7b859ca Fix provision action for provisioners set to never.
This updates the behavior of the provision action to never run a provisioner
that is specified to "never" run unless it has been explicitly requested. Also
adds test coverage to the provision action.
2017-03-13 13:53:31 -07:00
Chris Roberts dcdcf3f013 Add entry point for running vagrant-spec 2017-03-09 16:05:34 -08:00
Chris Roberts e09077ee33 Add box from local path and use generic name 2017-03-09 12:44:10 -08:00
Chris Roberts b66446712c Start adding test coverage on port collision handling action 2017-03-09 10:28:41 -08:00
Chris Roberts 9d1ec938ef Merge pull request #8341 from chrisroberts/enhancement/prerelease
Support spec prerelease matching
2017-03-07 15:02:17 -08:00
Chris Roberts c03ca851b1 Merge pull request #8327 from chrisroberts/plugins/local-path
Force path as preferred source on local install
2017-03-07 15:00:39 -08:00
Chris Roberts abf38106c0 Add shared helper method to detect if running version is prerelease 2017-03-07 10:36:14 -08:00
Chris Roberts dbf01572ef Merge pull request #8122 from chrisroberts/virtualbox/uid-gid
Use uid/gid from mount_options if provided for synced folders.
2017-03-06 14:21:11 -08:00
Chris Roberts d862133038 Remove hardcoded interface name from template 2017-03-06 14:18:26 -08:00
Chris Roberts 78e8e17869 Cast host value to string prior to empty? check.
Force string type prior to empty? check to prevent errors if
host ip value is nil. Add coverage for proper handling of nil
value.
2017-03-06 09:14:04 -08:00
Chris Roberts 6631fbdb9b Merge pull request #8073 from bshurts/fix/issue-7983
HyperV inaccurate winrm address - issue-7983
2017-03-06 09:11:34 -08:00
Chris Roberts 68be1422f8 Add test coverage for box sorting
Provides test coverage for proper box sorting using BoxCollection#all
and BoxCollection#find.
2017-03-06 08:19:49 -08:00
Chris Roberts 8a9fa302f0 Removing timing issues from test coverage 2017-03-03 09:49:55 -08:00
Tobias d074ac7906 guests/esxi: Added public_key_test 2017-02-28 08:22:05 -08:00
Chris Roberts 16c2b1ec50 Merge pull request #8291 from chrisroberts/enhancement/stderr-garbage
Discard initial stderr data
2017-02-24 07:34:28 -08:00
Chris Roberts 60cd9057a7 Add command deprecation module to push 2017-02-24 06:47:44 -08:00
Chris Roberts e2acb5250a Add command deprecation helper module 2017-02-24 06:22:39 -08:00
Chris Roberts ccdccf06b5 Merge pull request #8194 from chrisroberts/fix/curl-credentials
Scrub credentials from box URLs
2017-02-23 13:51:47 -08:00
Chris Roberts 74438cc495 Merge pull request #8196 from chrisroberts/fix/expand-vagrantfile-path
Allow VAGRANT_DOTFILE_PATH to be expanded as expected.
2017-02-23 13:33:07 -08:00
Chris Roberts 578c38e336 Update box add commands in acceptance tests 2017-02-23 10:12:17 -08:00
Chris Roberts 9394679cb7 Add coverage on box version in minimal init 2017-02-22 12:31:24 -08:00
Chris Roberts 64fd2f71d6 communicator/ssh: discard stderr data before command run 2017-02-16 15:43:04 -08:00
Chris Roberts 088829de9b Merge pull request #8270 from chrisroberts/enhancement/process-stop
Add new methods to Subprocess
2017-02-16 13:45:25 -08:00
Chris Roberts 0627e33652 Include test coverage on generated arch net config command 2017-02-09 17:41:44 -08:00
Chris Roberts e7e24ee853 Merge pull request #8248 from chrisroberts/fix/env-gems-path
Fix environment gems_path location
2017-02-08 14:18:41 -08:00
Chris Roberts 903428e569 Add Util::Subprocess#stop and Util::Subprocess#running? 2017-02-08 14:15:47 -08:00
Hasyimi Bahrudin 3d089a62d1 Add unit test for validate command 2017-02-07 14:59:20 +08:00
Chris Roberts 959bdada82 Fix environment gems_path location 2017-02-01 12:43:16 -08:00
Chris Roberts 25a2bdd279 Prevent generating environment variables with invalid empty names 2017-01-12 15:12:41 -08:00
Chris Roberts 832c62f2aa Allow VAGRANT_DOTFILE_PATH to be expanded as expected.
This allows custom paths that include special characters like `~`
to be properly expanded instead of resulting in joined root path
with special characters included.
2017-01-12 14:01:25 -08:00
Chris Roberts a055978d74 Scrub credentials from box URLs 2017-01-12 13:24:46 -08:00
Chris Roberts c11534e13c Merge pull request #8102 from mwrock/winrmv2
Refactor winrm communicator to use latest winrm gems and v2 api
2017-01-05 10:48:44 -08:00
Gilles Cornu 9493901e0c
provisioners/ansible: Add example of `host_vars` values that include quotes
Motivated by the support effort on GH-8158 ;-)
2016-12-28 23:23:43 +01:00
Chris Roberts 9f393fc1e0 Use uid/gid from mount_options if provided for synced folders.
This also extracts the gid/uid detection and upstart actions into
reusable module to provide consistent behavior.
2016-12-14 12:12:17 -08:00
Matt Wrock 725824e1dd refactor winrm communicator to use latest winrm gems and v2 api
Signed-off-by: Matt Wrock <matt@mattwrock.com>
2016-12-11 00:52:00 -08:00
Bryce Shurts e4626d088d issue-7983 - Helper now throws WinRMNotReady exception is host ip is reported as an empty string 2016-12-01 13:03:38 -06:00
Chris Roberts cf93efca2d Update tests for new information and cleaning method 2016-11-16 13:27:34 -08:00
Gilles Cornu 8caed8ea16 Merge pull request #7918 from mitchellh/gildegoma/fix-7195
Add `config_file` option to both Ansible provisioners
2016-11-15 08:29:30 +01:00
Chris Roberts ac74774fcb Merge pull request #8000 from chrisroberts/plugins/updates
Plugin handling updates
2016-11-14 13:24:52 -08:00
Chris Roberts 0f720a4386 Merge pull request #7985 from chrisroberts/shell-provisioner/checksum
Add md5 and sha1 checksum support to Downloader.
2016-11-14 13:19:22 -08:00
Chris Roberts 214f3ccee7 Merge pull request #7989 from chrisroberts/fix/more-networking-sorting
Only match interfaces without special characters
2016-11-14 13:17:19 -08:00
Chris Roberts beffa70941 Downloader checksum output information and digester usage
Add more output information around type of checksum being validated.
Use builtin Digest#file to read target file for generation of hexdigest.
2016-11-14 10:22:25 -08:00
Gilles Cornu 1de9f2228d
provisioners/ansible: Fix a mistake in a unit test 2016-11-13 21:00:58 +01:00
Chris Roberts 3afa7a3193 Update specs to match updated behavior for local install 2016-11-11 15:21:30 -08:00
Chris Roberts 5482692127 guests/linux: Only match interfaces without special characters 2016-11-10 07:19:26 -08:00
Chris Roberts f6a0861c40 Add stub test for salt provisioner 2016-11-09 16:29:23 -08:00
Chris Roberts 2d6071a55b Merge pull request #7793 from chrisroberts/enhancement/bundler-less
[core] Remove bundler usage for plugin management
2016-11-09 16:17:47 -08:00
Chris Roberts 2dcb47410f Merge pull request #7976 from chrisroberts/ssh/shell-compat
Allow custom generation of environment variable exports
2016-11-09 16:14:33 -08:00
Chris Roberts 8d2d324b13 Merge pull request #7980 from chrisroberts/synced-folder/auto-mount
Named synced folders
2016-11-09 16:12:03 -08:00
Chris Roberts da45ca707c Add md5 and sha1 checksum support to Downloader.
Allows checksum validation on downloaded files via Util::Downloader
using MD5 and/or SHA1 checksums. This also integrates checksum validation
support with the shell provisioner for downloaded remote files.
2016-11-09 16:05:39 -08:00
Björn Brala cdc5018b59 Add tests for prune command 2016-11-09 09:24:41 +01:00
Chris Roberts d528902edc Make guestpath an optional parameter for synced_folders 2016-11-08 15:33:30 -08:00
Chris Roberts dfc5e0d9a0 communicator/ssh: Allow custom generation of environment variable exports 2016-11-08 09:50:39 -08:00
Chris Roberts 1f5dd35d16 Remove bundler where no longer required 2016-11-07 20:00:38 -08:00
Chris Roberts 36d21f3c3f Add testing for plugin expunge command 2016-11-07 19:26:33 -08:00
Chris Roberts dbbd2d8e36 Remove deprecated methods and update tests. 2016-11-07 18:48:14 -08:00
Chris Roberts d1a778dbfb Include error handling when subprocess commands fail 2016-10-31 07:42:30 -07:00
Chris Roberts d89924afef Include test coverage on linux host nfs plugin 2016-10-29 17:54:41 -07:00
Chris Roberts dd7294b021 Merge pull request #7928 from chrisroberts/rsync/exclude-paths
synced_folders/rsync: Quote exclude paths
2016-10-26 07:16:15 -07:00
Chris Roberts be3fa85853 Merge pull request #7921 from chrisroberts/fix/key-fixups
Remove `set -e` usage for better shell compatibility
2016-10-25 14:43:04 -07:00
Chris Roberts 365b98fee6 Merge pull request #7926 from chrisroberts/networking/rhel
guests/redhat: Force NetworkManager to reload device configurations
2016-10-25 14:41:07 -07:00
Chris Roberts 05c5aab92a synced_folders/rsync: Escape exclude paths 2016-10-25 13:59:03 -07:00
Chris Roberts c39b3fbb76 guests/openbsd: Check package installation after installing package
The `pkg_add` command will return `0` when a package requested for
installation is not found. This adds a validation check to ensure
the rsync package is actually installed on the guest.
2016-10-25 12:16:52 -07:00
Chris Roberts 67f3c8b48c guests/redhat: Force NetworkManager to reload device configurations
When configuring network devices force NetworkManager to reload new
configuration files as they appear. This prevents NetworkManager from
attempting to continue managing devices on initial start up.
2016-10-25 07:45:38 -07:00
Chris Roberts fb4e4320b2 Remove `set -e` usage for better shell compatibility 2016-10-24 10:30:08 -07:00
Gilles Cornu a842abbc38
provisioners/ansible(both): Add config_file option
With this new option defined, the `ansible-galaxy` and
`ansible-playbook` commands generated by the Ansible provisioners will
be executed with the ANSIBLE_CONFIG environment variable set
accordingly.

Resolve GH-7195

This commit also fix the following open issues:
- Implement the pending RSpec examples about path existence checks
  performed by the ansible (remote) provisioner.
- In verbose mode, the ansible remote provisioner now correctly displays
  the Ansible Galaxy parameters ("role_file" and "roles_path") with
  single quotes (which is safer for potential copy-paste usage).

Additional Notes:
- Test coverage for `ansible_local` provisioner is still not
  implemented. See GH-6633.
- Test coverage for galaxy from host is not implemented yet (due to
  general issue with mocking both command executions, see
  https://github.com/mitchellh/vagrant/pull/6529#r45278451
2016-10-22 01:09:12 +02:00
Gilles Cornu b1ddc98e17
Merge pull request #7881 (Add playbook_command option)
Note that error messages were not adapted, and only mention
a generic "Ansible Software" when executed commands are failing.
We assume that people using the `playbook_command` option are
advanced users that will know all the components to be considered.
2016-10-10 23:18:24 +02:00
Chris Roberts 07ce1c6930 Merge pull request #7866 from chrisroberts/guest-linux/network-interfaces-sorting
guests/linux: Update network interface sorting implementation
2016-10-10 10:59:52 -07:00
Chris Roberts 7eb1091a71 Merge pull request #7874 from chrisroberts/enhancement/cast-box-version
config/vm: cast box version to string before string operations
2016-10-10 10:57:53 -07:00
Chris Roberts a8970281ce guests/linux: Properly sort interface name types
Add failing networking interface list sorting test with example
provided by #7883. Update sorting logic to properly handle different
types and differing array lengths.

Fixes #7883
2016-10-10 10:22:19 -07:00
Daniel Gonzalez 79a3cb8a14 Add unit test and documentation for playbook_command option 2016-10-10 16:56:36 +02:00
Daniel Gonzalez 58f2b0c8c7 Make ansible-playbook command configurable
The ansible-playbook command is currently hardcoded for the ansible and
ansible_local provisioners. This patch adds the config option
playbook_command to allow the user to change the command.
2016-10-09 20:48:50 +02:00
Chris Roberts 28f2ed56cf Merge pull request #7756 from alexoj/master
Fix Vagrant not prioritizing configured providers correctly
2016-10-07 17:14:54 -07:00
Mark Peek 4bf32e3f6d Fix typo (netmast => netmask) for Photon guest #7808 2016-10-07 12:32:21 -07:00
Chris Roberts 26b3a303d2 config/vm: cast box version to string before string operations 2016-10-06 16:16:59 -07:00
Chris Roberts e2b18fc65d guests/linux: Update network interface sorting implementation
Always pull ordered ethernet devices to the head of the list. Ensure
aliases are not included.
2016-10-04 17:25:00 -07:00
Chris Roberts f72cd286c1 Merge pull request #7831 from mwrock/nano
Use the cmd shell to check winrm availability to fix `vagrant up --no-provision` on nano
2016-09-30 16:16:42 -07:00
Chris Roberts 2e6b23c8fd Merge pull request #7848 from chrisroberts/fix/eth-first-predictable
guests/linux: Place ethernet devices at start of device list
2016-09-30 14:50:08 -07:00
Chris Roberts 0300df09fb guests/linux: Update constant name, freeze constant values 2016-09-30 12:11:54 -07:00
Chris Roberts 6e6b35f1c5 Merge pull request #7712 from mwrock/executor
fix #7489 preventing winrm connection leakage
2016-09-30 09:10:42 -07:00
Chris Roberts 9f468d2626 guests/linux: Place ethernet devices at start of device list 2016-09-29 15:33:29 -07:00
Chris Roberts a8cddf399d Merge pull request #7778 from justjake/subprocess-closable-stdin
Allow closing a Vagrant::Util::Subprocess's STDIN
2016-09-28 08:22:28 -07:00
Matt Wrock c5e1a6d8c0 use the cmd shell to check winrm availability 2016-09-26 14:07:11 -07:00
Gilles Cornu e8cf9bb168
provisioners/ansible: review pull request #7752
- Honour `ssh.proxy_command` setting (even when the Docker provider is
  used via a proxy host). Silly configurations may lead to silly
  behaviors, but let's apply the settings...
- Remove condition on `provider_config.connect_via_ssh`, which is
  a provider specific parameter (from vagrant-libvirt provider).
- Add a simple unit test
2016-09-21 23:40:20 +02:00
Alejandro Ojeda 0be221fbea Add test for provider priority fix
This commit adds tests for possible future regressions for the bug fixed
in the commit: "Fix Vagrant not prioritizing configured providers
correctly".

Two very similar tests were added because whether the bug manifests
or not depends on the order in which the provider dictionary keys
are iterated, which is specific to the dictionary implementation.
2016-09-18 04:04:32 +02:00
Jake Teton-Landis 51f68f41a2 Unit test Vagrant::Util::Subprocess's STDIN support
- create new unit test file for this class, as none existed.
- test `Vagrant::Util::Subprocess#execute` behavior relating to STDIN
  handling.
2016-09-15 18:19:01 -07:00
Chris Roberts a7537a6be0 Merge pull request #7726 from chrisroberts/fix/rsync-exclude
Ignore files excluded from sync on chown
2016-08-19 09:58:31 -07:00
Chris Roberts 5e44e308a5 Merge pull request #7725 from chrisroberts/fix/package-machine-dir
Machine data directory for base box package
2016-08-19 09:48:38 -07:00
Chris Roberts dd6ad2fbf3 guests/linux: only use effective group ID when appropriate 2016-08-17 06:53:26 -07:00
Chris Roberts f577ca3d23 commands/package: provide machine data directory for base box 2016-08-17 06:49:12 -07:00
Chris Roberts 185a7dfc2e guests/rsync do not chown files excluded from sync 2016-08-16 15:13:19 -07:00
Matt Wrock 64828f1ed3 fix #7489 preventing winrm connection leakage 2016-08-13 07:49:08 -07:00
Chris Roberts b87e02205c Merge pull request #7675 from chrisroberts/en/linux-cap-halt
guests: Prevent ssh disconnect from causing error on halt
2016-08-12 16:47:22 -07:00
Chris Roberts 3abfbec5a6 Merge pull request #7623 from carlosefr/relative-dotfile-path
Support Vagrantfile-relative VAGRANT_DOTFILE_PATHs
2016-08-12 16:17:10 -07:00
Chris Roberts dd91269491 guests: Prevent ssh disconnect from causing error on halt 2016-08-12 13:25:39 -07:00
Chris Roberts ce3329e184 guests/linux: Always order discovered network interfaces 2016-08-12 10:31:41 -07:00
Chris Roberts f122afeed2 Add more coverage on ssh connector on connect behavior. Remove subject usage. 2016-08-11 15:39:09 -07:00
Chris Roberts 9d4962c836 communicator/ssh: Add test coverage 2016-08-11 13:26:56 -07:00
Chris Roberts aadf1ba5ae Use common hash key style within project 2016-08-11 13:07:25 -07:00
Chris Roberts 597f49dda8 Add failing rsync test checking for private key option inclusion 2016-08-11 12:59:26 -07:00
Zack Train cb70749bd8 redux of pr 7398 for ssh-agent key fix 2016-08-11 11:48:10 -07:00
Chris Roberts 571659a5d1 guests/openbsd: include -h option on shutdown
For OpenBSD versions prior to 5.7 the `-h` option _must_ be provided
to the `shutdown` command when `-p` is used. Later versions no longer
require the `-h` option but still allow it for compatibility.

http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/shutdown/shutdown.8?rev=1.40&content-type=text/x-cvsweb-markup
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/shutdown/shutdown.c?rev=1.40&content-type=text/x-cvsweb-markup
2016-08-10 09:14:08 -07:00
Charlie Sharpsteen 4144b45122 Fix RDP connections on OS X
Changes introduced in 982af05 caused the RDP configuration file to be written
with all settings on one line instead of one setting per line. The Microsoft
Remote Desktop client for OS X rejects these configuration files as being
malformed. This patch restores the configuration to one line per setting and
adds tests to guard against regression.
2016-08-09 14:04:50 -07:00
Carlos Rodrigues 22a22e8bb6 Missed a spot 2016-07-28 01:18:48 +01:00
Carlos Rodrigues 1b0a28bd4a One extra smoke test 2016-07-28 01:09:14 +01:00
Carlos Rodrigues 211523d052 Added tests for VAGRANT_DOTFILE_PATH 2016-07-28 01:01:29 +01:00
Jose Luis Duran 820607bbf6 Fix `authorized_keys` permissions for BSDs
This is an extension of a6760dd8e7,
applied to BSD guests.

Related to #7610
2016-07-25 18:25:58 -03:00
hendrenj 41063204ca added unit tests for .remove_public_key method in VagrantPlugins::GuestLinux::Cap 2016-07-19 11:45:46 -06:00
Colin Shea b31b240c8c
Support installing synced folder clients on arch 2016-07-18 22:33:04 -04:00
Seth Vargo 1849990517
Fix tests 2016-07-18 21:31:25 -04:00
Seth Vargo 8f3b6511f2
guests/linux: Add shared cap for listing network interfaces 2016-07-18 21:12:54 -04:00
Seth Vargo 66cbe7b41e
Fix failing tests 2016-07-18 21:12:53 -04:00
Seth Vargo 851eff1288
guests/linux: Ensure NFS retries when mounting
Fixes GH-7443
2016-06-19 14:34:33 -04:00
Seth Vargo 2cbc819298 Merge pull request #7484 from mitchellh/sethvargo/bsd_halt
guests/bsd: Centralize logic for halting guests
2016-06-18 15:12:09 -04:00
Seth Vargo 07e6d0e707
guests/bsd: Centralize logic for halting guests 2016-06-18 15:06:20 -04:00
Seth Vargo 3f27af7e95
core: Provide a way to globally disable box update checking
This adds a new environmental variable `VAGRANT_BOX_UPDATE_CHECK_DISABLE`,
which instructs Vagrant to not check for box updates when running
regular Vagrant commands. This behaves the same as the existing
`config.vm.box_update_check` configuration option, but can be set
globally. Vagrantfile-supplied options will take precedence.

Fixes GH-7479
2016-06-18 14:46:46 -04:00
Satoshi Matsumoto de9abc8f72
guests/redhat: fix network configuration in CentOS 5
ip command is not on PATH by default in CentOS 5 so call it with the full path.
2016-06-18 14:14:25 -04:00
Seth Vargo 6284a9ac50
guests/bsd: Move NFS mounting logic into shared
A number of the BSD guests used very old mounting options or just
ignored some parameters entirely. This fixes that.

- Closes #7474
- Fixes #7466
2016-06-17 21:04:23 -04:00
Seth Vargo 0c268f7b3f
guests/bsd: Add shared BSD guest for common behavior 2016-06-17 20:16:36 -04:00
James Wilson 358ad8f18f Use ip instead of deprecated ifconfig for Red Hat/CentOS guests 2016-06-16 10:06:58 +01:00
Eugene Zamriy eaa4e11c62 Add CloudLinux 7 to RHEL 7 flavors. 2016-06-12 16:51:55 +03:00
Torsten Juergeleit 754c1eebe5 fixes #6220 - adds check for communicator type and executes the mount script as encoded command via powershell from within 'sh' for communicator != winrm 2016-06-11 16:40:25 +02:00
Gilles Cornu a7dfc73b85 provisioners/ansible: honor galaxy_roles_path when running ansible-playbook
This commit include the following changes:
- systematically set ANSIBLE_ROLES_PATH environment variable when
  galaxy_roles_path is defined.
- slightly refactor to introduce the concept of "provisioning working
  directory" (possible usage in the future for resolving GH-7195)
- fix a bug in ansible-galaxy execution by the ansible_local provisioner
  if the paths contains blank characters.

Fix #7269
2016-06-11 07:28:05 +02:00
Gilles Cornu bb9dba56ac provisioners/ansible_local: add "pip" install_mode
These changes have been validated against the following guest systems:
- Debian 7 and 8
- Ubuntu 12.04, 14.04 and 16.04
- Fedora 21 and 23
- CentOS 7
- OracleLinux 7
- Scientific Linux 7

At the moment, the pip setup (via get-pip.py script) is not working for
RHEL6-like systems (CentOS 6.6, OracleLinux 6.5, Scientific Linux 6),
because Python 2.6 has been deprecated and is no longer supported by
Python core team. I consider this limitation with low priority in
Vagrant context.

The `:pip` install_mode is currently not implemented for the following
platforms:
- OpenSUSE
- ArchLinux
- FreeBSD

Known Issue: By using get-pip.py script, any previous pip installation
will be most probably overrided. This could be an issue for Python
developers who would prefer to keep their base box setup untouched. In
future iteration, it could be possible to choose to reinstall/upgrade
pip or not. issue for Python developers who would prefer to keep their
base box setup untouched. In future iteration, it could be possible to
choose to reinstall/upgrade pip or not.

Resolve GH-6654

Resolve GH-7167 as the `version` option is now considered to select the
version of Ansible to be installed.
2016-06-08 23:53:58 +02:00
Seth Vargo 073e65abf0 Merge pull request #7387 from phyber/fix/master/prepare_nfs_settings_scoped_hash_overrides_fix
Fix/master/prepare_nfs_settings scoped hash overrides fix
2016-06-06 18:41:13 -04:00
Seth Vargo c8ceb06f6d
guests/amazon: Initial addition
Fixes GH-7254
2016-06-06 18:22:34 -04:00
Seth Vargo 233120eebd
templates/general: Fix failing tests 2016-06-06 12:34:45 -04:00
Seth Vargo 4418efd4a4
guests/general: Use require_relative in tests 2016-06-06 12:24:07 -04:00
Seth Vargo dc3b9c84da
guests/debian: Do not use shared helper, fix tests 2016-06-06 12:21:50 -04:00
Seth Vargo 9cbf45be59
guests/suse: Add tests for network_scripts_dir 2016-06-06 11:58:42 -04:00
Seth Vargo c98deee116
guests/suse: Add tests for halt 2016-06-06 11:58:42 -04:00
Seth Vargo c9f21a1852
guests/suse: Configure rsync in one command 2016-06-06 11:58:42 -04:00
Seth Vargo c259032f80
guests/suse: Install NFS client in one command 2016-06-06 11:58:42 -04:00
Seth Vargo 94af771b71
guests/suse: Configure networks in one command
This also uses the new predictable network naming.
2016-06-06 11:58:41 -04:00
Seth Vargo b091f4fe82
guests/suse: Change host name in one command 2016-06-06 11:58:41 -04:00
Seth Vargo 0bdf6f5ad4
guests/slackware: Configure networks in one command
This also switches to using new predictable naming for networks.
2016-06-06 11:58:40 -04:00
Seth Vargo a7bbb484ad
guests/slackware: Configure hostname in one command 2016-06-06 11:58:40 -04:00
Seth Vargo 96a1cdf08f
guests/redhat: Add tests for network_scripts_dir 2016-06-06 11:58:39 -04:00
Seth Vargo 60d2f4e1b4
guests/redhat: Install RedHat in one command 2016-06-06 11:58:39 -04:00
Seth Vargo 3098c13869
guests/redhat: Configure NFS in one command
Previously this was very complicated trying to flip between Ruby and
bash. This commit uses a single bash command that decides between yum
and dnf in the script itself.
2016-06-06 11:58:38 -04:00
Seth Vargo e09d342284
guests/redhat: Add tests for flavor 2016-06-06 11:58:38 -04:00
Seth Vargo cc26c46066
guests/redhat: Configure networks in one command
This commit also switches to using predictable network names.
2016-06-06 11:58:38 -04:00
Seth Vargo b91c167b19
guests/redhat: Change host name in one command 2016-06-06 11:58:38 -04:00
Seth Vargo 8c28361f16
guests/pld: Add tests for network scripts dir 2016-06-06 11:58:37 -04:00
Seth Vargo cf989d1534
guests/pld: Add tests for flavor 2016-06-06 11:58:37 -04:00
Seth Vargo 9702abb5c4
guests/pld: Change host name in one command 2016-06-06 11:58:36 -04:00
Seth Vargo 0002c003b3
guests/photon: Improve docker tests 2016-06-06 11:58:36 -04:00
Seth Vargo 9040ecafeb
guests/photon: Configure networks in one command
This also removes code that was completely unused during network
configuration.
2016-06-06 11:58:36 -04:00
Seth Vargo 2e943428a9
guests/photon: Change host name in one command 2016-06-06 11:58:35 -04:00
Seth Vargo d7bc7c2267
guests/omnios: Add rsync_install functionality 2016-06-06 11:58:34 -04:00
Seth Vargo c441732c59
guests/omnios: Update NFS folder mounting in one command 2016-06-06 11:58:34 -04:00
Seth Vargo 95972c1527
guests/omnios: Set hostname in one command 2016-06-06 11:58:34 -04:00
Seth Vargo 6b1749a6fb
guests/linux: Add tests for port 2016-06-06 11:58:32 -04:00
Seth Vargo 3e2374ad38
guests/linux: Add tests for nfs_client_installed 2016-06-06 11:58:32 -04:00
Seth Vargo 837713c2d1
guests/linux: Mount NFS in one command 2016-06-06 11:58:32 -04:00
Seth Vargo e2b7e28082
guests/linux: Update insert_public_key cap to be one command 2016-06-06 11:58:32 -04:00
Seth Vargo 0bd6d73a7f
guests/linux: Add tests for halt capability 2016-06-06 11:58:31 -04:00
Seth Vargo d4159e4208
guests/linux: Add tests for choosing addressable IP 2016-06-06 11:58:31 -04:00
Seth Vargo cf74347980
guests/freebsd: Install rsync in one command 2016-06-06 11:58:30 -04:00
Seth Vargo de64bd03de
guests/freebsd: Mount NFS folders in a single command 2016-06-06 11:58:30 -04:00
Seth Vargo bf51f6a71d
guests/freebsd: Insert public key in one command 2016-06-06 11:58:30 -04:00
Seth Vargo 7806223020
guests/freebsd: Add tests to halt capability 2016-06-06 11:58:30 -04:00
Seth Vargo 2b08151977
guests/freebsd: Configure predictable networks in a single command
This commit refactors the freebsd networking to:

1. Use predictable network naming
2. Properly handle DHCP vs static networks on up and reload [GH-5852]
3. Perform all networking configuration in a single command to prevent
   partial configuration.
2016-06-06 11:58:29 -04:00
Seth Vargo a444110993
guests/freebsd: Configure hostname in a single command
This updates freebsd to set the hostname in a single command and prepend
the hostname to the /etc/hosts file.
2016-06-06 11:58:29 -04:00
Seth Vargo dbb2d99278
guests/debian: Update guest capabilities
This updates the guest capabilities to run in as few communicator
commands as possible. Additionally, it fixes a number of issues around
hostname and idempotency.

This patch was tested against:

- puphpet/debian75-x64
- debian/jessie64
- debian/wheezy64

with custom networking, custom hostname, and rsync shared folders.
2016-06-06 11:58:28 -04:00
Seth Vargo dc883aa46f
guests/darwin: Add tests for get_addressable_ip_addr 2016-06-06 11:58:27 -04:00
Seth Vargo 5683a3b8ca
guests/darwin: Configure hostname in a single command 2016-06-06 11:58:27 -04:00
Seth Vargo 3ca048a8fa
guests/coreos: Configure networks in one command
This commit configures all the network devices in a single command.
2016-06-06 11:58:26 -04:00
Seth Vargo fee0545b23
guests/coreos: Do not use sudo for looking up hostname 2016-06-06 11:58:26 -04:00
Seth Vargo 50690dab12
guests/atomic: Add tests for docker capability
This commit adds missing test coverage for the Docker capability on
atomic guests.
2016-06-06 11:58:25 -04:00
Seth Vargo 4f0c3474f2
guests/atomic: Update hostname capability
This commit does a few things:

1. Make the hostname update idempotent with `grep -w`
2. Add the given hostname to `/etc/hosts` as recommended by the docs
3. Add missing tests
2016-06-06 11:58:25 -04:00
Seth Vargo d77ad5c941
guests/arch: Configure networks in one command
This commit updates the procedure for configuring arch networks to occur
in a single command. Previously, each network was configured
independently. If, for some reason, one of the networks destroyed the
SSH connection, the box would be irrecoverable. This commit does not
alleviate that behavior, but attempts to mitigate it by running all
network-related configuration commands in a single communicator (SSH)
session.

The new procedure looks like this:

1. Upload a temp file to /tmp/vagrant-network-id... for each interface
  on the guest.
2. Compile a commands array (of bash) to execute after all network
  configurations have been uploaded.
3. Concatenate all the commands together in a single communicator
  session.

This was tested against `terrywant/archlinux` using the following Vagrantfile:

```ruby
Vagrant.configure(2) do |config|
  config.vm.box = "terrywang/archlinux"
  config.vm.hostname = "banana-ramama.example.com"

  config.vm.network "private_network", type: "dhcp"

  config.vm.network "private_network", ip: "33.33.33.10"

  config.vm.provision "file", source: "Vagrantfile", destination: "/tmp/vf"
  config.vm.provision "shell", inline: "echo hi"
end
```
2016-06-06 11:58:24 -04:00
Seth Vargo 41d61120a5
guests/arch: Change hostname in one command
This commit updates the procedure for changing the hostname on arch
guests to occur in a single command. Previously, setting the hostname
and adding the value of the hostname to the /etc/hosts file was done in
two different uploads. This reduces the cycle to a single upload, making
provisioning a bit faster.

Additionally, this changes the behavior of the /etc/hosts file to:

1. Not remove localhost as an alias of 127.0.0.1
2. Prepend our custom hostname before localhost

The resulting /etc/hosts file will look something like:

127.0.0.1 my-host.example.com my-host
127.0.0.1 localhost.mydomain localhost

Tested against `terrywang/archlinux` using the following Vagrantfile:

```ruby
Vagrant.configure(2) do |config|
  config.vm.box = "terrywang/archlinux"
  config.vm.hostname = "banana-ramama.example.com"

  config.vm.network "private_network", type: "dhcp"

  config.vm.network "private_network", ip: "33.33.33.10"

  config.vm.provision "file", source: "Vagrantfile", destination: "/tmp/vf"
  config.vm.provision "shell", inline: "echo hi"
end
```
2016-06-06 11:58:24 -04:00
David O'Rourke 514193090a prepare_nfs_settings: Add scoped hash override test. 2016-06-03 15:19:03 +01:00
Gilles Cornu a7ee56459b provisioners/ansible(both): fix ansible config files presence checks
With this change, the presence of Ansible configuration files (like
playbook file, inventory path, galaxy role file, etc.) is no longer
performed by the `config` classes, but by the `provisioner` classes
(at the beginning of the provision command).

This change fixes several issues:

- Resolve #6984 as `provision` method are only executed when remote
  (ssh) communication with the guest machine is possible.
- Resolve #6763 in a better way than 4e451c6 initially did.
- Improve the general provisioner speed since the `config` checks are
  actually triggered by many vagrant actions (e.g. `destroy`,...), and
  can also be triggered multiple times during a vagrant run (e.g. on
  callback request made by the machine provider).

Unlike the former `config`-based checks, the provision action won't
collect all the invalid options, but only report the first invalid
option found and abort the execution.

Some unit tests were not implemented yet to save my scarce "open source
contribution time" for other important issues, but they should be done
at last via GH-6633.
2016-06-01 06:40:23 +02:00
Seth Vargo bf96b3348b
provider/docker: Add docker-exec command
This adds a new core command, `docker-exec`, which allows the user to
exec into an already-running container.

- Fixes #6566
- Fixes #5193
- Fixes #4904
- Fixes #4057
- Fixes #4179
- Fixes #4903
2016-05-31 20:05:26 -04:00
Seth Vargo e1ea81847d Merge pull request #7276 from ryanheffernan/fix/master/issue7275
Adding Fedora IPv6 Static Address Support
2016-05-31 17:55:41 -04:00
Seth Vargo cf02135290 Merge pull request #7359 from mitchellh/sethvargo/cache_platform
Cache the results of common operations
2016-05-31 11:03:46 -04:00
Seth Vargo 49ce775b53
Prefix tempfiles with vagrant- 2016-05-31 00:18:16 -04:00
Seth Vargo 7014aa3bab
Remove custom tempfile class
This is not actually providing any additional utility and also causes
namespace conflicts with people trying to use the real Tempfile class.
2016-05-30 23:21:47 -04:00
Seth Vargo 2a230a11e2
Cache the results of common operations
This commit changes Vagrant::Util::Platform to cache the result of some
common operations. These values are highly unlikely to change over the
course of a single Vagrant run and they are only cached for that run.
2016-05-30 18:27:12 -04:00
Seth Vargo 38f23fe001
providers/docker: Allow TCP and UDP ports on same number
This commit changes the way ports are aggregated in the Docker provider.
Previously ports were aggregated by their "number", but that is not a
truly unique representation. Instead, the protocol is now taken into
account when generating the port map.

Fixes GH-5527
2016-05-30 17:23:44 -04:00
Seth Vargo bba1cbc72f
Add --box-version to `vagrant init`
This also adds a test suite for that particular command, updates the
documentation, and adds some examples.

Fixes GH-5004
2016-05-30 15:33:58 -04:00
Gilles Cornu 8190fba872 provisoners/ansible: improve config test coverage
Changes:

- Add "config" unit tests for `ansible_local` (guest)
- Share some "config" examples between both ansible provisioners
- Move `config_host.rb` specific examples to `config/host.rb`
- Add a requirement to "../helpers" in `config/guest.rb` in order to be
  able to run the related unit tests

References:

- This is the first part of GH-6633 resolution
- This change is a handy prerequisite for GH-6570

Not addressed yet:

- FIXME (guest.rb): Some test-double stubs are currently not working as
  expected, and the related checks are commented out for the moment
  (no idea why, but this is not urgent to be fixed because of GH-7335
  rejection. See also GH-6984)
- FIXME (shared.rb): The guest-based config should actually NOT return
  an error when the extra_vars file cannot be found, but only display a
  a warning (similarly to the changes done for GH-6763, see 4e451c6)
2016-05-29 17:01:37 +02:00
Seth Vargo 61adbf77d4 Merge pull request #7287 from KierranM/win-ssh-forward
[#7202] Always forward SSH on Windows
2016-05-29 00:58:18 -04:00
Seth Vargo b993699af6
Cleanup more files in tests 2016-05-29 00:34:00 -04:00
Seth Vargo ca337122dc
Fix test issues 2016-05-28 23:44:11 -04:00
Seth Vargo 5a4f345363
Use Util::Tempfile when configuring networks
This fixes a fairly large tempfile leak. Vagrant uses a template
renderer to write network configuration files locally to disk. Then,
that temporarily file is uploaded to the remote host and moved into
place. Since Vagrant is such a short-lived process, GC never came along
and cleaned up those tempfiles, resulting in many temporary files being
created through regular Vagrant usage.

The Util::Tempfile class uses a block to ensure the temporary file is
deleted when the block finishes. This API required small tweaks to the
usage, but provides more safety to ensure the files are deleted.
2016-05-28 23:22:34 -04:00
Seth Vargo fb60d34236
Add unique names to all tmpdir and tempfile calls in tests + cleanup
This commit attempts to uniquely identify the temporary files and
directories that are created during test runs. Where it was a quick
fix, this commit also removes the temporary files and directories.

There are still a ton of temporary files due to calls to
.isolated_environment in the tests without an easy API an easy way
to provide a closer to that function.
2016-05-28 23:22:34 -04:00
Seth Vargo 68329817ad Merge pull request #7290 from phyber/fix/master/prepare_nfs_settings_machine_ip_fix
prepare_nfs_settings: Try harder to get all machine IPs.
2016-05-27 18:38:03 -04:00
Seth Vargo 8c11b537ba
Allow Mac/Windows users to use Docker native 2016-05-27 17:36:07 -04:00
David O'Rourke c5f975838d prepare_nfs_settings: Add spec test for static/dynamic IP combo 2016-05-10 11:40:16 +01:00
Kierran McPherson 4afe0478b8 Fix broken test; Add explicit test
Hopefully the explicit test will prevent this from being regressed again in the future
2016-05-04 17:26:46 +12:00
Ryan Heffernan d7714f058d Added basic unit test 2016-04-30 13:22:52 -07:00
Gilles Cornu b6a3f0e8f1 Merge pull request #7103 from mitchellh/gildegoma/fix-6726
ansible_local: use double quoting for 'extra-vars', 'limit' and 'start-at-task' options (except if defined via `raw_arguments` option)
2016-04-21 00:29:43 +02:00
Gilles Cornu b2286388f0 provisioners/ansible: add basic config validators
With this change, the `raw_arguments` and `raw_ssh_args` options are:
- STILL automatically converted as an Array when they are set a String
  (no behaviour change)
- rejected if they are not of Array data type otherwise

Additional Notes:
- the 'as_array' tiny helper has been removed since it was no longer
  used.
- there is for now no deeper validation (i.e. verifying that the Array
  elements are only *String* objects)
2016-04-20 23:54:19 +02:00
Gilles Cornu ab036ddd0b provisioners/ansible: don't format raw_arguments
With cb80286a4a, the helper function
stringify_ansible_playbook_command was also applied on the
`raw_arguments` content, which is not wanted. Given that users have used
the `raw_arguments` option as a workaround to avoid the bug GH-6726,
this new change ensure that any `--extra-vars` option passed as a raw
argument won't be additonally enquoted by the ansible_local
provisioner.

This change also improves the ansible remote provisioner verbose output,
but has no impact on its behaviour, which was already correct.

Note that this refactoring introduces some code duplications that are not
very elegant (see ansible_playbook_command_for_shell_execution in
host.rb and execute_ansible_playbook_from_host in base.rb). I hope we
can find a better implementation later, but it is good enough for now
since all these parts are covered by corresponding unit tests (the
`ansible_local` stuff being tested via the verbose output of the ansible
remote provisioner).
2016-04-20 23:50:42 +02:00
Seth Vargo 2d0943b0ad Print a warning when token and envvar are set
Fixes GH-7206
2016-04-08 10:16:10 -04:00
Seth Vargo 8319f159b6 Use hostname if no node_name is set
Fixes GH-7063
2016-03-17 20:15:11 -05:00
Gilles Cornu 47c0833277 ansible_local: use double quotes instead of single quotes
Before this minor change, the '--limit' and '--start-at-task'
ansible-playbook command line arguments were enclosed into single
quotes. Using double quotes adds a bit more flexibility, especially
about the task name referred by `start_at_task` option.

It also aligns with the handling of the '--extra-vars' parameter
(see cb80286).
2016-03-05 17:25:54 +01:00
Gilles Cornu cb80286a4a ansible_local: put json extra-vars in double quotes
Without this change, the JSON string generated from the `extra_vars`
Ruby hash is passed without enclosing quotes and is then not parseable
by the ansible-playbook command when exectuted in a usual shell context.

In this changeset, the ansible (remote) unit test coverage is improved
to cover both usage of `extra_vars` (ansible_local unit tests are still
missing).

Additional Notes:

 - Double quotes are favored to single quotes in order to allow usage of
   any character for the variable values. For this reason additional
   escaping is appended to JSON-inner double quotes and backslashes.

 - This problem was not affecting the `ansible` remote provisioner
   (which is running the ansible-playbook command via the childprocess
   Ruby library). But with this change, the `verbose` output will also
   now be correct for a copy-paste reuse.

 - After this change, all the "--extra-vars" arguments (also a var
   file passed with the @-syntax or anything coming via the
   `raw_arguments` option) are "blindly" and systematically enclosed
   in double quoted and double-escaped.
   This is not optimal and can potentially break with peculiar values
   (e.g. a double quote character (") cannot be used in a json value
   when using `raw_arguments`). That said, I think that the current
   solution is a reasonable trade-off, since the official `extra_vars`
   option should now be able to cover a great majority of use cases.

Fix #6726
2016-03-05 17:24:28 +01:00