Commit Graph

2119 Commits

Author SHA1 Message Date
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
Seth Vargo 8c68c6ec70 Use "stable" as the default Chef channel
Previously the default channel was "current", but after discussion with
@coderanger on GH-6979, it seems like this was a poor design decision.
Instead, we should use the stable channel and allow users to opt-in to
prerelease versions.

Fixes GH-6979
2016-02-08 10:49:48 -05:00
Seth Vargo 4b4f1fc24c Add extra_args cap for darwin rdp
This commit fixes GH-5523.
2016-02-03 10:03:57 -05:00
Seth Vargo 27157b5408 Merge pull request #6893 from mmickan/prerelease-version-fix
Prerelease version fix
2016-02-03 09:57:25 -05:00
Seth Vargo 3b252d37eb Merge pull request #6922 from mwrock/negotiate
upgrade to latest winrm and winrm-fs versions
2016-02-03 09:52:48 -05:00
Seth Vargo 63beaaef14 Merge pull request #6963 from mitchellh/sethvargo/str_ver
Always use a string for Vagrantfile version
2016-02-02 09:48:19 -05:00
Seth Vargo b24e69eb60 Always use a string for Vagrantfile version 2016-02-02 09:43:28 -05:00
Seth Vargo 3f6ac05d7c Revert "Escape identify file path" 2016-02-02 09:38:53 -05:00
Matt Wrock f912a81362 powershell and cmd calls should use commnand_executor to reuse oprn winrm shell 2016-01-27 11:59:10 -08:00
Matt Wrock 7ef4ae9e10 use NTLM/Negotiate authentication over basic authentication 2016-01-27 11:57:41 -08:00
Mark Mickan 31ece8324b Add tests for using prerelease box versions 2016-01-20 11:18:27 +10:30
Gilles Cornu ddbd2a4cfc provisioners/ansible: prefer ssh '-i' argument
In cd93721, I relied on a suprising combination of quotes to protect ssh
execution to strip the quoted path to the private key file.
Since any ssh command line argument can be passed via
`ANSIBLE_SSH_ARGS`, it is quite more readable and easy to rely on the
`-i` argument, which is not affected like `-o IdentityFile=...` and also
supports multiple occurences.

See also http://sourceforge.net/p/fuse/mailman/message/30498048/

Finally fix #6671

Note that I decided to not squash both commits for better
documentation and traceability.
2015-12-16 10:29:13 +01:00
Gilles Cornu cd93721f8f provisioners/ansible: use quotes for the IdentityFile OpenSSH command line arguments
Surprisingly (to me at least), a simple quote enclosure was not enough
to fix the problem.

Caveat: the stringified ansible-playbook command logged in verbose mode
is wrongly formatted (no quotes are escaped).

Fix #6671
2015-12-16 09:54:53 +01:00
Mitchell Hashimoto 06a1461081 Merge pull request #6662 from lukebakken/fixes/lrb/gh-4503-hyper-v-admin-privs
Fix for 4503
2015-12-14 15:56:55 -08:00
Mitchell Hashimoto 884782f3ce Merge pull request #6603 from mitchellh/sethvargo/cleanup_output
Only run cleanup tasks when they are defined on the provisioner
2015-12-14 15:41:17 -08:00
Mitchell Hashimoto d47c7c74d7 Merge pull request #6659 from swiftstack/change_ipv6_adapter_address
Use <prefix>::1 as the IPv6 adapter IP.
2015-12-14 15:37:28 -08:00
Luke Bakken 57187c9f88 Add method to detect if a Windows user is a member of the "Hyper-V Administrators" group.
Modify Hyper-V provider to require a user to either be an Administrator or a member of "Hyper-V Administrators"
2015-12-10 07:04:39 -08:00
Hasyimi Bahrudin 77031a79b7 pushes/local-exec: add args config 2015-12-10 17:00:35 +08:00
Timur Alperovich a56e118b16 Use <prefix>::1 as the IPv6 adapter IP.
Set the IPv6 adapter IP to be <prefix>::1. Otherwise, guest to host
communication over IPv6 is not routed correctly. This means that
consumers should not specify <prefix>::1 IP addresses to VirtualBox,
which should be a reasonable restriction.

Fixes #6658
2015-12-09 17:22:02 -08:00
Timur Alperovich bcf61d001b Only consider the VM interfaces in the IPv6 fixup.
Vagrant should only consider the host-only interfaces used by the
virtual machine in the IPv6 fixup code. There may be other interfaces
present on the system with IPv6 addresses that for various reasons
would fail the routing check (for example, an interface with no
machines attached).

The patch changes the behavior to not scan all of the host-only
interfaces and adds a unit test for the behavior (that the correct IP
is validated).

Lastly, there is a small fix here that may not be an issue for most
people where the IPv6 prefix was asummed to be a multiple of 16 for
the purposes of constructing the UDP probe datagram. This assumption
has been removed.

Fixes #6586
2015-12-08 10:44:07 -05:00
Seth Vargo 4e21dd78e4 Ignore case when comparing checksums
Fixes GH-6648
2015-12-07 10:30:46 -05:00
Kamjar Gerami b7e9437a77
#3539 - Fixed syntax, language and logic according to comments made by reviewer in PR #6639 2015-12-04 10:05:07 +01:00
Kamjar Gerami f5f568b66b
Added plain Symbol group name for unit test 2015-12-04 02:16:01 +01:00
Kamjar Gerami af6a80472e #3539 - Can't use alphanumeric patterns for box names in ansible.groups: added unit test for host range patterns 2015-12-04 01:26:04 +01:00
Gilles Cornu dde7f4697f Merge branch 'gildegoma/review-6626'
Related to #6619, #6626 and #6627
2015-12-03 21:52:34 +01:00
Gilles Cornu 8517014a99 provisioners/ansible: update inventory groups tests
With the introduction of inventory variables, group members provided as
String are not splitted (by ' ') into an array (instead of
auto-conversion to a single-item array).
2015-12-03 09:39:12 +01:00