Commit Graph

3268 Commits

Author SHA1 Message Date
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 28f2ed56cf Merge pull request #7756 from alexoj/master
Fix Vagrant not prioritizing configured providers correctly
2016-10-07 17:14:54 -07:00
Chris Roberts c3eb1e355b Merge pull request #7802 from chrisroberts/safe_exec/windows
[windows] Use subprocess for safe_exec on windows
2016-09-30 14:42:40 -07:00
Chris Roberts 977733790a Include debug notification when using subprocess 2016-09-30 12:16:53 -07:00
Chris Roberts 5872611d59 [windows] Use subprocess for safe_exec on windows 2016-09-15 13:08:58 -07:00
Jake Teton-Landis ceb69e6266 Allow closing a Vagrant::Util::Subprocess's STDIN
Previously, there was no way to close the STDIN stream of a subprocess,
so commands that read from stdin in a subprocess would hang forever,
such as `/bin/sh -s`. If one tried to close the stdin, the
IO.select() call in Subprocess#execute would raise an error for calling
select() on a closed IO.

Here's a concrete example of a command that needs to close STDIN to work
properly:

```ruby
script = SOME_VERY_LONG_STRING
command = %w(ssh foo.example.com /bin/sh -s foo bar)
result = ::Vagrant::Util::Subprocess.execute(*command) do |type, data_or_io|
  if type == :stdin
    data_or_io.write(script)
    data_or_io.write("\n")
    data_or_io.close
    next
  end

  puts "Remote: #{data_or_io}"
end
```
2016-09-04 16:45:38 -07:00
Alejandro Ojeda 50ca748b5c Fix Vagrant not prioritizing configured providers correctly
Fixes #7135: config.vm.provider not setting provider in multi-machine Vagrantfile
2016-08-25 03:34:23 +02: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
Zack Train cb70749bd8 redux of pr 7398 for ssh-agent key fix 2016-08-11 11:48:10 -07:00
Seth Vargo 1702584d1e Merge pull request #6765 from PeterMosmans/windows-path-fix
Fix for #6761 (fixes incomplete #6598)
2016-08-08 11:59:26 -04:00
Carlos Rodrigues 218b697d5e This looks cleaner 2016-07-24 19:01:54 +01:00
Carlos Rodrigues 188a7dab0c Another try, without string substitution 2016-07-24 18:40:09 +01:00
Carlos Rodrigues 9ebc028745 Better checks, hopefully 2016-07-22 14:59:05 +01:00
Carlos Rodrigues 92104fec72 Use match instead of start_with 2016-07-22 14:39:44 +01:00
Carlos Rodrigues bf0486e659 Vagrantfile-relative VAGRANT_DOTFILE_PATH 2016-07-22 14:08:18 +01:00
Seth Vargo 36838d36b7
Fix failing test 2016-07-18 22:38:27 -04:00
Seth Vargo 7ed6bb5bef Merge pull request #7569 from rossi-fi/fix/master/7568
Use RFC- and cURL-friendly file:/// URI. Fixes #7568.
2016-07-18 22:20:03 -04:00
Seth Vargo 581568cf5a Merge pull request #7571 from rossi-fi/fix/master/7570
Strip leading slash left in front of drive letter by uri.path
2016-07-18 22:19:55 -04:00
Seth Vargo 2acaaff801
state_file: fsync and binmode 2016-07-18 21:59:18 -04:00
Seth Vargo ea17ad4530 Merge pull request #7550 from cgwalters/plugin-atomic-rewrite
plugin: Write out state file via create-new-then-rename
2016-07-18 21:58:23 -04:00
Seth Vargo 8f10dbca90 Merge pull request #7587 from alexmv/disabled-conflicts
Skip checking for conflicts on ports that are disabled
2016-07-18 21:55:33 -04:00
Seth Vargo 3b2ffae400
guests/bsd: Print a very descriptive error when mounting vbox folders
BSD-based guests do not support VirtualBox shared folders. This is a
common source of confusion in Vagrant. This new error clearly explains
that this is not a bug in Vagrant and provides instructions on how to 
disable them.
2016-07-18 21:12:58 -04:00
Seth Vargo 7e88266999
guests/linux: Properly escape and retry vbox shared folder mounting 2016-07-18 21:12:57 -04:00
Alex Vandiver 3d2fde9260 Skip checking for conflicts on ports that are disabled
Currently, the supported way (see GH#1922) to disable the default port
2222 port forward is:

    config.vm.network :forwarded_port, guest: 22, host: 2222, disabled: true

However, the port collision detection runs on all ports, regardless of
the `disabled` flag.  This leads it to attempt to connect to port
2222, notice it is taken, and abort with a port conflict -- even
though it will not be attempting to use the port at all.

Skip disabled ports when doing port conflict detection.

A workaround that does not require a Vagrant upgrade to one containing
this fix is to instead set `auto_correct` on the disabled port:

    config.vm.network :forwarded_port, guest: 22, host: 2222, disabled: true, auto_correct: true

This allows the disabled port to be reshuffled off to some other
unused port.
2016-07-14 19:52:38 -07:00
Colin Walters 72c1972181 plugin: Write out state file via create-new-then-rename
This makes updates atomic, so it's useful generally.  However
I'm making this change specifically to support rpm-ostree.

For more information, see:
https://bugzilla.redhat.com/show_bug.cgi?id=1352152
2016-07-12 16:42:24 -04:00
Markus Rossi 4730602ceb Strip leading slash left in front of drive letter by uri.path (see GH-7570). 2016-07-12 15:20:04 +03:00
Markus Rossi 8768d7921d Fix for #7568 Windows drive letter in config.vm.box_url is ignored 2016-07-12 12:01:23 +03:00
Seth Vargo 05aafedc6d
core/bundler: Reset specs in a way that works with new Rubygems 2016-06-20 15:19:21 -07:00
Seth Vargo 23e50c98f9
core/box_collection: Ensure removal
The docs for Ruby say Pathname#rmtree will recursively delete, but
apparently that is a lie, at least on Windows (see GH-7496). Switch to
using FileUtils to ensure the directory is deleted.

Fixes GH-7496
2016-06-20 07:16:08 -04:00
Seth Vargo 177b7784dd
guests/darwin: Allow ipv6 static networks 2016-06-19 12:01:52 -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 d01ddeeb43
Check stdout instead of process output
Fixes GH-7465
2016-06-16 16:20:15 -04:00
Gilles Cornu 6ee69e3150 Merge pull request #7190 from electrofelix/ansible-parallel-race
Fix a race condition in the concurrent generations of the ansible inventory file, while running `vagrant up --parallel`.

Closes GH-6526
2016-06-09 14:56:03 +02:00
Mikhail Zholobov db3aad3822
Require "vagrant/util/presence" in package action 2016-06-09 13:13:58 +03:00
Karl Isenberg f084fc7d78 Revert 3f9fb2ef03 from GH-2769
- For compatibility with ba77d4b533

Fixes GH-7073
2016-05-31 14:52:43 -07: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 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 d44fcf2d52
Allow customization of keys_only & paranoid SSH
This adds two new SSH configuration options:

- `keys_only`
- `paranoid`

These values were previously hard-coded, but can now be user-specified.

Fixes GH-4275
2016-05-29 18:03:03 -04:00
Seth Vargo 159e1ec1f1
Use a real file for bundler 2016-05-29 00:41:59 -04:00
Seth Vargo 1b414d3d9e
That file has to exist 2016-05-29 00:18:33 -04:00
Seth Vargo 3d2390fc94
Give a unique, prefixed name to all tempfiles
This commit basically grepped the code base for all uses of Dir.mktmpdir
and Tempfile.new/open and ensures the value is unique within the
code base and also prefixed with `vagrant-`.

Previously, most invocations of these commands simply used "vagrant",
thus making them indistinguishable when trying to identify leaks.
2016-05-28 23:22:34 -04:00
Seth Vargo fb7c4033a9
Do not create a tempfile when downloading box metadata
The only reason we were using Tempfile was to generate the path. This
commit switches to using `Dir::Tmpname.create`, which accomplishes the
same thing without the overhead of creating and removing a tempfile.
2016-05-28 23:22:34 -04:00
Seth Vargo 3a27c29577
Add a new util for generating tempfiles 2016-05-28 23:22:33 -04:00
Seth Vargo cee6e6c7bc
Fix file leaking in bundler 2016-05-28 17:01:59 -04:00
Christian Hofstaedtler ba77d4b533
Allow Vagrant to work with newer Rubygems
Fixes GH-7073
2016-05-27 17:19:33 -04:00
Seth Vargo efdb148f61
Move pre-flight package validation to middleware
This commit separates the scratch and output directory creation from the
main package middleware into its own PackageSetupFolders middleware.
Additionally, the validation that ensures an output file does not exist
is moved into a validation function that can be shared across multiple
methods.

This refactor permits a pre-flight check to ensure box packaging would
be successful before actually stopping the VM.

Fixes GH-7351
2016-05-27 17:07:04 -04:00
Seth Vargo 2a02ceb870
Bump box resume delay to 24h
This commit bumps the box resume delay time to 24h and makes it a
constant because I had a bugger of a time actually finding this in the
code :frowny:.

Fixes GH-7272
2016-05-27 15:18:50 -04:00
Seth Vargo bc74cb4008 Merge pull request #7158 from mitchellh/sethvargo/auth_metadata
Authenticate metadata box urls
2016-04-05 10:46:01 -04:00
Darragh Bailey 36ad4d53cf core: Multi machine use of active_machines requires locking of index
Ensure multi machine access of other machine state information through
iterating `active_machines` and retrieval of cached machines cannot
have multiple threads update the state of machines simultaneously as
this triggers a Machine Lock exception.

Machine state information retrieved from the index, returns a locked
object. Since iteration of active_machine, and retrieval of each
machine from the cache can be triggered by any plugin, it is possible
for another machine to inadvertently access the state and trigger an
update, which the thread owning the machine is currently in the process
of updating it already. This results in a Machine Locked exception
occurring if the attempt to retrieve the cached state from the index
occurs before the other thread calls release.

Partially-Fixes: #6526
2016-03-31 17:27:36 +01:00