Commit Graph

3500 Commits

Author SHA1 Message Date
Chris Roberts 53b9f1747c Allow plugin_init_error to provide all information. Include final reset on specifications. 2016-11-17 16:40:51 -08:00
Chris Roberts 818f7acb7b Provide better internal consistency of installed plugin gems.
Refactors reusable actions into isolated methods. Supports installation/removal
without activation to prevent unintended conflicts during upgrades and cleanup.
Introduced custom resolver set to handle multiple installed versions of gems
which enables proper cleanup.
2016-11-16 13:26:13 -08:00
Chris Roberts 06e1b2f52c Include installed gem version plugin information. Clean after install and update. 2016-11-16 13:19:43 -08:00
Chris Roberts fb85bb1c7b Include plugin initialization error class 2016-11-16 13:18:35 -08:00
Chris Roberts 33c9d6183a Provide more log information about configured plugins 2016-11-16 13:17:38 -08:00
Chris Roberts e2d96f942f Provide nice error output when plugin initialization fails
Include extra logging during initialization to display error if encountered
and solution set prior to performing activations.
2016-11-15 15:50:39 -08:00
Chris Roberts 44d3aedc5b When bundler is in use, require `:plugins` group 2016-11-14 15:28:22 -08: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 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
Chris Roberts 174fe65d66 Sort plugins by name when generating install list 2016-11-11 15:11:45 -08:00
Chris Roberts 3edd0b57e9 Add debug logging output to Bundler implementation 2016-11-11 15:08:59 -08:00
Chris Roberts bd3f0c442c Only use Gem sources that are provided 2016-11-11 14:50:20 -08:00
Chris Roberts 1691e3af58 Only install from defined sources unless install is local 2016-11-11 14:44:14 -08:00
Chris Roberts d8455c0a9a Add custom sources if not included 2016-11-11 14:33:26 -08:00
Chris Roberts 6e40d46c50 Fix up local gem plugin installation when not published remotely 2016-11-11 14:25:03 -08:00
Chris Roberts ea13988367 Properly support plugin auto-loading with logging information 2016-11-11 14:24:25 -08:00
Chris Roberts 1ed27faa9f Remove usage of $vagrant_bundler_runtime within enabled check 2016-11-11 14:23:55 -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
Chris Roberts 36d88ee268 Track installed gem version and display in startup logger information 2016-11-07 20:16:46 -08:00
Chris Roberts 1f5dd35d16 Remove bundler where no longer required 2016-11-07 20:00:38 -08:00
Chris Roberts 3fb5913af1 Update .init! to attempt repair if instructed 2016-11-07 18:48:51 -08:00
Chris Roberts d5c5561302 Allow disable of user plugins if repair command is requested 2016-11-07 18:48:51 -08:00
Chris Roberts 1fb4553d14 [core] Remove bundler usage for plugin management 2016-11-07 18:48:51 -08:00
David O'Rourke a33892e4df Maintain a version dir map in box_collection.
This is required since Gem::Version will mangle pre-release version
numbers.
To get around this, we keep a mapping of
`Gem::Version.to_s => versiondir.`

This allows us to properly sort by version when picking a box while
still returning pristine versiondirs when required.
2016-11-01 15:59:23 +00:00
David O'Rourke 7b89374dce Fix version sorting in box_collection.rb 2016-11-01 14:57:06 +00:00
Chris Roberts d1a778dbfb Include error handling when subprocess commands fail 2016-10-31 07:42:30 -07:00
Chris Roberts d490bb4b7a Include autoloader for StringBlockEditor 2016-10-29 17:53:45 -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
Luke Bakken 52e98ffdfb Improve detection of admin and hyper-v admin rights via using SIDs and powershell 2016-10-13 14:22:08 -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
Björn Brala 6ed612e93b Move package_setup_files to general lib to minimize code duplication 2016-10-07 17:31:15 +02:00
Bjorn Brala 5877e8fe22 Sart refactor duplicate classes 2016-10-06 08:55:59 +02: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
Seth Vargo 3305764f71 Rescue Errno::ENOTCONN
Fixes GH-7182
2016-03-31 17:02:50 +02:00
Seth Vargo 42a8ed658e Authenticate metadata box urls 2016-03-19 17:05:43 -04:00
Pravinchandar Raajendiran af9d0df635 Fix for #4608
Added support for Port forwarding in an IP aliased environment. The change
makes the following forwarding rule(s) possible.

Ex: eth0 is ip aliased to have a range of IP addresses 10.20.30.0/24.

In the Vagrant file, we can now have an entry like the following and
it will just work! Note the host port 8081 is the same for both .1 and .2.

  Vagrant.configure("2") do |config|
    config.vm.network "forwarded_port", guest: 80, host: 8080
    config.vm.network "forwarded_port", guest: 81, host: 8081, host_ip: 10.20.30.1
    config.vm.network "forwarded_port", guest: 82, host: 8081, host_ip: 10.20.30.2
  end
2016-02-14 22:16:24 +11: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 1166800b65 Use SSL and HTTPS links where appropriate 2016-01-25 13:14:54 -05:00
Mark Mickan 1378eebea9 Use pristine version string when constructing path to box
Without this change, the version string may be mutated when passed through
Gem::Version.new(version).to_s before being used to construct the box
directory.  This is a problem when using prerelease version numbers because,
for example, it will look for "~/.vagrant.d/boxes/1.0.0.pre.alpha.1" when it
should be looking for "~/.vagrant.d/boxes/1.0.0-alpha.1".
2016-01-20 10:22:00 +10:30
Peter Mosmans 4b889ee641 Fix for #6761 (fixes incomplete #6598) 2015-12-30 07:56:08 +10:00
Mitchell Hashimoto cf4b03d701 core: do not convert drive letters to UNC paths [GH-6598] 2015-12-24 12:36:14 -08:00
Mitchell Hashimoto 0de44a116b core: use env var for bundle retries [GH-6705] 2015-12-24 12:16:12 -08: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 739d29e8fa Merge pull request #6612 from reedloden/virtualbox-checksum
Add checksum validation for the VirtualBox installs on Windows and OS X
2015-12-14 15:39:46 -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
Seth Vargo 4e21dd78e4 Ignore case when comparing checksums
Fixes GH-6648
2015-12-07 10:30:46 -05:00
Mitchell Hashimoto 30d9e243bb fix failing tests 2015-12-02 18:03:08 -08:00
Mitchell Hashimoto 5c4e71e317 core: machine output provider info for the machine 2015-12-02 13:06:07 -08:00
Mitchell Hashimoto cee517d963 core: fix machine readable UI to contain target and have proper format 2015-12-02 13:06:07 -08:00
Reed Loden 7d81728e45 Add checksum validation for the VirtualBox installs on Windows and OS X
Use Vagrant::Util::FileChecksum to validate the downloaded VirtualBox
installers.

SHA-256 checksums for VirtualBox files are available at
https://www.virtualbox.org/download/hashes/5.0.10/SHA256SUMS.

Fixes #6611.
2015-11-28 00:04:41 -08:00
Seth Vargo 64ff69c64b Only run cleanup tasks when they are defined on the provisioner
This helps with some confusion caused in GH-2538, since the output says:

> Running cleanup tasks for 'shell' provisioner...

But that's actually not true. It is running the cleanup tasks iff the 
provisioner defined a cleanup task. This commit changes the 
provisioner_cleanup middleware to only run cleanup tasks if the subclass
defines a cleanup task.

The reason we can't just check if the provisioner `respond_to?` the
`cleanup` method is because the parent provisioner base class (which 
all provisioners inherit from) defines a blank cleanup method. This is
important because it means we never risk calling an unimplemented
cleanup function, and it also helps define the public API for a 
provisioner.
2015-11-26 13:11:51 -05:00
Timur Alperovich 5b910c186c Fix the resolution of SafeEnv.
Recent change broke bundler.rb due to incorrect scope resolution (the
error is: uninitialized constant Vagrant::Bundler::SafeEnv
(NameError).
2015-11-24 12:18:50 -08:00
Seth Vargo 8c3f833e8e Use the new presence helpers in the Chef provisioner 2015-11-23 18:33:47 -05:00
Seth Vargo 4c55c39b2d Add presence helpers 2015-11-23 18:04:18 -05:00
Mitchell Hashimoto 7f93868c86 Merge pull request #6567 from mitchellh/b-prune-folders
core: remove saved synced folders not from Vagrantfile
2015-11-23 10:06:51 -08:00
Mitchell Hashimoto 21cacb6eb8 core: file:/// for windows paths [GH-5288] 2015-11-23 09:53:28 -08:00
Mitchell Hashimoto 1405395d81 core: catch EINVAL on setting env vars [GH-6017] 2015-11-23 09:39:51 -08:00
Mitchell Hashimoto 4e1ba3a027 core: fix file URLs from cygwin on Windows [GH-5747] 2015-11-23 09:30:27 -08:00
Mitchell Hashimoto 104066c678 core: assume all windows shells now have TTYs 2015-11-23 09:10:33 -08:00
Mitchell Hashimoto d5fa7416ff core: more heuristics for determining Cygwin 2015-11-21 11:17:36 -08:00
Mitchell Hashimoto c471f37955 core: parse line numbers for Vagrantfile syntax errors on Win [GH-6445] 2015-11-20 15:34:52 -08:00
Mitchell Hashimoto b6f0b498e4 core: expand Windows short paths 2015-11-20 14:49:21 -08:00
Mitchell Hashimoto 9c1b014536 core: remove saved synced folders not from Vagrantfile 2015-11-20 10:25:09 -08:00
Mitchell Hashimoto 2ade66443e core: retry bundler network calls a few times [GH-6097] 2015-11-19 23:57:16 -08:00
Mitchell Hashimoto d3ab73cf4a core: when packaging, preserve generated key [GH-5780] 2015-11-19 18:18:51 -08:00
Seth Vargo 02a351841e Use an array instead of map 2015-11-19 16:32:43 -08:00
Eli Skeggs 2b9173e15a Support environment variable forwarding, fixes #4131
Signed-off-by: Eli Skeggs <eskeggs@globesherpa.com>
2015-11-19 16:25:54 -08:00
Mitchell Hashimoto 1ccd91aada Merge pull request #4473 from rtkrruvinskiy/https_metadata
Add HTTPS download options to `box update` and `box outdated`
2015-11-19 16:16:48 -08:00
Mitchell Hashimoto e0ef592544 core: retry if server doesn't support byte ranges on download [GH-4479] 2015-11-19 16:14:13 -08:00
Mitchell Hashimoto c541767949 core: add tests for box collection cleanup [GH-6002] 2015-11-19 15:59:58 -08:00
Mitchell Hashimoto ed9bc1e847 Merge branch '3570-box-data-left' of https://github.com/ievgenp/vagrant into ievgenp-3570-box-data-left 2015-11-19 15:45:47 -08:00
Seth Vargo eac1960d45 Fix some Ruby 2015-11-19 10:25:32 -08:00
Mitchell Hashimoto 2ffbe4e6e1 core: more robust WIndows admin check [GH-5616] 2015-11-18 20:27:07 -08:00
Mitchell Hashimoto be29915bed Merge pull request #6542 from mitchellh/b-dotfile
core: don't make dotfile path if no Vagrantfile
2015-11-18 18:10:19 -08:00
Mitchell Hashimoto 079ee6ea95 Merge pull request #6540 from mitchellh/b-non-http-head
core: don't do HEAD request for box on non-HTTP [GH-5477]
2015-11-18 18:09:31 -08:00
Mitchell Hashimoto 7c9fd58786 core: log if not checking box metadata 2015-11-18 18:09:18 -08:00
Mitchell Hashimoto 646414b347 core: don't make dotfile path if no Vagrantfile 2015-11-18 17:48:24 -08:00
Mitchell Hashimoto 7c49fd1418 core: fix crash on invalid checksum type [GH-6327] 2015-11-18 17:36:52 -08:00
Mitchell Hashimoto 891c47c742 core: don't do HEAD request for box on non-HTTP [GH-5477] 2015-11-18 16:52:40 -08:00
Mitchell Hashimoto 1a7937ed50 core: don't replace insecure key on base package [GH-5310] 2015-11-18 16:25:07 -08:00
Mitchell Hashimoto 0ce636d1a3 core: avoid locking in trap context 2015-11-18 16:07:49 -08:00
Mitchell Hashimoto 85f1e05e2a core: prune machine if non-existent CWD from index [GH-4742] 2015-11-18 15:48:59 -08:00
Mitchell Hashimoto 9ce26393bb Merge pull request #6479 from legal90/fix-fp-collision-handling
Bugfix: Remove redundant app call from action "handle_forwarded_port_collisions"
2015-11-18 15:13:40 -08:00
Mitchell Hashimoto 9e1a119a4b Merge pull request #6475 from nikelmwann/linux-host-use-xfreerdp
Prefer xfreerdp for RDP connections on Linux hosts.
2015-11-18 15:12:47 -08:00
Mitchell Hashimoto cccdb87388 Merge pull request #6407 from josephfrazier/patch-1
handle_forwarded_port_collisions.rb: fix typo: "Reparied" -> "Repaired"
2015-11-18 14:38:03 -08:00
Mitchell Hashimoto d69d7047b2 Merge pull request #6386 from legal90/fix-osx-nic-order
Fix network configuration in OS X (Darwin) guests
2015-11-18 14:33:51 -08:00
Mitchell Hashimoto 946d2fe154 Merge pull request #4738 from robkinyon/skip_default_sources
Added a --plugin-clean-sources parameter
2015-11-18 11:20:34 -08:00
Austin Schutz 96e4544949 use env.ui for action logging 2015-11-18 11:15:02 -08:00
Austin Schutz 566e21d3fc add machine readable logging, action starts/ends 2015-11-18 11:15:02 -08:00
Gilles Cornu c6ef73a6fa Merge 'gildegoma/2103-ansible-local-v2'
Resolve conflict in CHANGELOG.md
2015-11-10 23:05:29 +01:00
Christian Berendt 3f4a372d57 Remove all available versions of a box
This patch introduces a new parameter --all for the remove
command of the box plugin. Setting this parameter will remove
all available versions of a specific box.

Example usage:

```
$ vagrant box list
ubuntu/trusty64 (virtualbox, 20150427.0.0)
ubuntu/trusty64 (virtualbox, 20150430.0.0)
ubuntu/trusty64 (virtualbox, 20150506.0.0)
```

```
$ vagrant box remove ubuntu/trusty64
You requested to remove the box 'ubuntu/trusty64' with provider
'virtualbox'. This box has multiple versions. You must
explicitly specify which version you want to remove with
the `--box-version` flag. The available versions for this
box are:

 * 20150427.0.0
 * 20150430.0.0
 * 20150506.0.0
```

With the --all parameter it is possible to remove all versions at once.

```
$ vagrant box remove --all ubuntu/trusty64
Removing box 'ubuntu/trusty64' (v20150506.0.0) with provider 'virtualbox'...
Removing box 'ubuntu/trusty64' (v20150430.0.0) with provider 'virtualbox'...
Removing box 'ubuntu/trusty64' (v20150427.0.0) with provider 'virtualbox'...
```
2015-11-09 09:32:18 +00:00
Gilles Cornu 9bfdaf7e75 provisioners/ansible: introduce ansible_local
With this change, the existing host-based Ansible provisioner is
refactored to share a maximum of code with this new guest-based Ansible
provisioner.

At this stage of development, the existing unit tests are intentionally
modified as little as possible, to keep safe the existing funtionalities.

Other issues resolved by this changeset:
 - Display a warning when running from a Windows host [GH-5292]
 - Do not run `ansible-playbook` in verbose mode when the `verbose` option
   is set to an empty string.
2015-11-08 10:42:48 +01:00
Mitchell Hashimoto baea923e9c commands/up: automatically install providers 2015-11-05 13:58:15 -08:00
Mitchell Hashimoto 69d9bc0fe8 Environment can_install_provider and install_provider 2015-11-05 11:50:10 -08:00
Mitchell Hashimoto dad5962ebb hosts/darwin: support virtualbox install 2015-11-04 15:47:56 -08:00
Mitchell Hashimoto d4ddb3c2f3 commands/provider 2015-11-04 14:20:48 -08:00
Mikhail Zholobov c60e116121 Remove redundant app call from action "handle_forwarded_port_collisions"
This call should not be in the `handle` helper method. It is specified in the `call` method already.
2015-11-03 17:16:31 +02:00
Eric Winkelmann e687f81fce Re-word Linux RDP error to include `xfreerdp`.
Changed the name of the error LinuxRDesktopNotFound to
LinuxRDPClientNotFound and re-worded error text in
templates/locales/en.yml to include `xfreerdp` when listing supported
RDP clients.
2015-11-02 23:42:01 -08:00
Mitchell Hashimoto 32e981ce7c core: machine-readable output should include standard UI output
As a "ui" type
2015-10-26 18:10:26 -07:00
Joseph Frazier a59dc04b69 handle_forwarded_port_collisions.rb: fix typo: "Reparied" -> "Repaired" 2015-10-17 19:42:58 -04:00
Mitchell Hashimoto c17efbed75 core: ignore VAGRANT_DOTFILE_PATH if a child environment
This causes issues since the child environment almost certainly doesn't
share data with the parent. In a larger scope, we should find a way to
encode the data path somehow on `vagrant up`.
2015-10-16 10:28:30 -07:00
Mikhail Zholobov f930fa94af Move "cant_read_mac_addresses" error to the global space
Now it is used not only by Windows, but by Darwin guests as well.
2015-10-09 14:57:41 +03:00
Mitchell Hashimoto 36cfc77167 providers/virtualbox: make prepare clone a core thing 2015-10-08 16:02:37 -04:00
Mitchell Hashimoto f0ddac8c9a providers/virtualbox: clone 2015-10-08 12:33:55 -04:00
Mitchell Hashimoto 9e371277a9 core: IsEnvSet remove invert opt 2015-10-08 10:38:18 -04:00
Mitchell Hashimoto ed4df21c85 commands/snapshot: push and pop 2015-10-07 22:52:27 -04:00
Mitchell Hashimoto 2c936b2e37 providers/virtualbox: tidying up the linked clone feature 2015-10-06 14:11:41 -04:00
Mitchell Hashimoto d519d927fa Merge branch 'VB-linked-clone-support' of https://github.com/mpoeter/vagrant into mpoeter-VB-linked-clone-support 2015-10-06 13:50:34 -04:00
Mitchell Hashimoto ec0b0fb7f9 providers/virtualbox: IPv6 host only networks 2015-09-30 17:23:25 -07:00
Sam Phippen eeb750cd33 Catch encoding problems with sources provided to Vagrant::Config::Loader#set
Here we implement a naive solution to #5605 which catches the case that
a provided source contains an object which cannot be inspected, because
an object contained within in has an #inspect string that returns a
string that is incompatible with the encoding in
`Encoding.default_external` or a string which cannot be downcast to
7-bit ascii.

The Ruby VM implementation of "#inspect" implements this checking on
these lines of code: http://git.io/vZYNS. A Ruby level override of
this method does not cause this problem. For example:

```ruby
class Foo
  def inspect
    "😍".encode("UTF-16LE")
  end
```

will not cause the problem, because that's a Ruby implementation and the
VM's checks don't occur.

However, if we have an Object which **does** use the VM implementation
of inspect, that contains an object that has an inspect string which
returns non-ascii, we encounter the bug. For example:

```ruby
class Bar
  def inspect
    "😍".encode("UTF-16LE")
  end
end

class Foo
  def initialize
     @bar = Bar.new
  end
end

Foo.new.inspect
```

Will cause the issue.

The solution this patch provides basically catches the encoding error
and inserts a string which attempts to help the user work out which
object was provided without blowing up. Most likely, this was caused
by a user having a weird encoding coming out of one of the sources
passed in, but without a full repro case, it's not clear whether a patch
should be applied to a different object in the system.

Closes #5605.
2015-09-08 17:30:50 +01:00
Seth Vargo d64d229c0f Merge pull request #5928 from mitchellh/sethvargo/ssh_exec_run_command
Use the same ssh args for ssh with a command as ssh exec
2015-07-27 11:02:36 -04:00
Seth Vargo d88d126ad9 Use a properly-formatted custom User-Agent 2015-07-20 23:33:31 -04:00
Ievgen Prokhorenko 562ed26533 Fix #3570 'Box data left in ~/.vagrant.d/boxes after removal' 2015-07-19 16:44:38 +03:00
Manuel Pöter f4d1d068f9 Merge branch 'master' into VB-linked-clone-support 2015-07-13 10:56:17 +02:00
Mitchell Hashimoto dec5f70a1e core: fix jailbreaking of plugins
/cc @sethvargo
2015-07-10 15:34:59 -06:00
Seth Vargo fc1d2c29be Use the same ssh args for ssh with a command as ssh exec 2015-07-10 13:55:00 -06:00
Gilles Cornu faeb8a9440 core: plugin management requires bundler
With this change, the `Vagrant::plugins_enabled?` is now false when the
embedded Bundler is not available.

Resolve the broken RSpec unit tests after
479323f1e8.
2015-07-10 13:37:33 +02:00
Mitchell Hashimoto 479323f1e8 for newer versions of Bundler, store the runtime 2015-07-09 22:12:47 -06:00
Seth Vargo fafa3fa437 Add another log statement 2015-07-09 16:06:03 -06:00
Seth Vargo 68ef9676c7 Jailbreak out of the subprocess and restore original environment 2015-07-09 16:06:03 -06:00
Seth Vargo 46563560f4 Update with_clean_env helpers 2015-07-09 16:06:02 -06:00
Seth Vargo 50a64ea30b Add a log statement 2015-07-09 16:06:02 -06:00
Seth Vargo 0a5d37fc8b Reset the original environment if we are running something outside of the installer 2015-07-09 16:06:02 -06:00
Mitchell Hashimoto cea44847de Merge branch 'filter_synced_folders' of https://github.com/maxlinc/vagrant into maxlinc-filter_synced_folders 2015-07-09 15:05:52 -06:00
Mitchell Hashimoto b0b9f67faf Merge pull request #5514 from MiLk/fixes/several-boxes-same-name
Allow to use several boxes with the same name
2015-07-09 15:00:03 -06:00
Mitchell Hashimoto b3e935203e remove unuse dline 2015-07-09 14:25:10 -06:00
Mitchell Hashimoto 3cad495064 Merge pull request #5887 from msabramo/config.ssh.ssh_command
Add setting config.ssh.ssh_command
2015-07-09 14:24:48 -06:00
Seth Vargo 3ba10b43ab Restore the original environment from Bundler and the installer if given 2015-07-09 13:14:34 -06:00
Seth Vargo d8d5a66fa5 Add a function to get to the "original" environment with Vagrant
This function only works when used with the official Vagrant installer.
2015-07-09 12:34:04 -06:00
Mitchell Hashimoto 0b6938d8ab core: don't prepare folders in disable ode 2015-07-08 15:43:42 -06:00
Mitchell Hashimoto 28bea401c0 core: if interrupted, don't open metadata file 2015-07-07 12:38:45 -06:00
Mitchell Hashimoto 71940c60ba providers/virtualbox: error if uid mismatch 2015-07-06 18:13:59 -06:00
Mitchell Hashimoto 1330244fef core: save the UID that created a machine 2015-07-06 18:04:16 -06:00
Mitchell Hashimoto cb51b4fe7f Merge pull request #5334 from legal90/fix-data-dir-creation
Create machine data directory only after the machine will be checked
2015-07-06 16:33:33 -06:00
Mitchell Hashimoto 6c06db776d core: test for URI escaping 2015-07-06 16:26:06 -06:00
Mitchell Hashimoto 341534299d core: ssh private_key_path overwrites insecure key [GH-5632] 2015-07-06 16:17:54 -06:00
Mitchell Hashimoto 79115d1ccc core: retry SSH keygen on RSAError [GH-5056]
/cc @sethvargo
2015-07-06 14:44:23 -06:00
Mitchell Hashimoto bb25bb3be9 core: actually get the proper encoded subprocess command [GH-5128] 2015-07-06 14:39:50 -06:00
Mitchell Hashimoto 80ce9ab1f3 core: change select timeout to 1 for WIndows [GH-5309] 2015-07-06 13:54:00 -06:00
Mitchell Hashimoto ab27413954 core: make note that the box is being added directly [GH-5311] 2015-07-06 12:17:49 -06:00
Mitchell Hashimoto e759df11a0 core: fix crash for missing options [GH-5550] 2015-07-06 10:36:41 -06:00
Mitchell Hashimoto 36fa04fd1e providers/virtualbox: catch subprocess launch error [GH-1483] 2015-07-05 17:01:06 -07:00
Marc Abramowitz 9240ea30b6 Add setting config.ssh.ssh_command
Lets the user specify what ssh to use or even direct Vagrant to use an
ssh wrapper like sshrc (https://github.com/Russell91/sshrc).
2015-07-01 23:33:13 -07:00
Manuel Pöter c3151c0b88 Ignore failure when trying to delete lock file.
Deleting the lock file can fail when another process is currently trying to acquire it (-> race condition).
It is safe to ignore this error since the other process will eventually acquire the lock and again try to delete the lock file.
2015-06-03 13:27:03 +02:00
Seth Vargo 345935887f Style fixes 2015-06-02 17:18:50 -04:00
Philip Wrenn 4c8fe42d70 Ignore possible version directories that are hidden folders, i.e. dot folders. 2015-06-02 17:09:10 -04:00
Seth Vargo b92d4b21a1 Add UI::Interface#color? 2015-06-01 11:49:09 -04:00
Seth Vargo 6b2ef13785 Be more defensive when trying to get the line number
Since this is the last line of defense before raising an error, we want to make
sure we don't cause an error while trying to render the error.
2015-05-31 18:32:23 -07:00
Adam Spiers ce13051d61 eliminate guesswork with Vagrantfile errors
If the Vagrantfile has some kind of error, display not only
its path and the exception message, but also the originating
line number and exception class.

Also log the full backtrace when the error is in a provider
block, just as it is done when it's outside a provider block.
2015-05-31 18:25:51 -07:00
Dmitry Moskalchuk 26e3994319 Add option to enable trusted HTTP redirects 2015-05-31 09:34:02 -07:00
Seth Vargo 07efee776e Merge pull request #5677 from mrahtz/fix/master/unescape-curl-passwords
Escape/unescape cURL URLs/auth
2015-05-30 21:40:18 -07:00
Seth Vargo 6210f13338 Merge pull request #5750 from alh84001/feature/capability_guest_darwin_mount_smb
Capability to mount smb shares in darwin guests
2015-05-30 21:34:53 -07:00
Seth Vargo 294b0bca41 Merge pull request #5433 from marxarelli/feature/ui-custom-pipes
core: allow IO redirection of UI for testing
2015-05-30 12:49:09 -07:00
Seth Vargo a0b86a8474 Style fixes 2015-05-30 12:34:05 -07:00
Seth Vargo cecd15edac Merge pull request #5395 from delftswa2014/fix-local-download
Fixed inaccurate downloading status message
2015-05-30 12:33:28 -07:00
Seth Vargo 03b945d4d0 Merge pull request #5399 from delftswa2014/improve-package-error-message
Improved the package error message
2015-05-30 12:32:19 -07:00
Seth Vargo 72ea1d3e64 Merge pull request #5658 from legal90/fix-repackage
Fix issue #5657: Take only files while box repackage
2015-05-30 12:03:50 -07:00
Seth Vargo 2175625b61 Merge pull request #5698 from aneeshusa/dont-report-plugins-when-disabled
If plugins are disabled, report them as not available.
2015-05-30 11:56:44 -07:00
Seth Vargo 98a23c5a5e Merge pull request #5604 from bluehaoran/patch-1
Update ssh.rb to detect PLink v0.64
2015-05-30 11:51:52 -07:00
Matija K b387f0e15d Capability to mount smb shares in darwin guests 2015-05-24 12:39:28 +02:00
Aneesh Agrawal 16ac4e2321 If plugins are disabled, report them as not available.
Allows usage of VAGRANT_NO_PLUGINS env var to disable plugins.

Fixes #5430.
2015-05-14 08:04:11 -04:00
Mikhail Zholobov 079e06cd09 box/package: Take only files while packaging the new box
Fixes GH-5657
2015-04-30 16:08:18 +03:00
Matthew Rahtz 29c77e5719 Escape/unescape cURL URLs/auth
so that we can deal with special characters in usernames and passwords
2015-04-29 14:34:00 +01:00
Haz 0962a2d151 Update ssh.rb to detect PLink v0.64
PLink 0.64 (released 28-2-2015) changes the command-line description, so the previous text-match no longer works.
2015-04-17 12:34:40 +10:00
Jean-Francois Bibeau 45e14a8dc4 UNC paths should have backslashes, not front-slashes. 2015-04-16 11:02:58 -04:00
Jean-Francois Bibeau 415837c544 moved function to platform utils, added unit test as per @sethvargo 2015-04-06 16:51:55 -04:00
Emilien Kenler 1c1dd1ef8a Allow to use several boxes with the same name 2015-03-23 16:30:23 +09:00
Dan Duvall 3b8bc2a433 core: allow IO redirection of UI for testing
Use of $stdin, $stdout, and $stderr globals makes testing difficult. By
exposing the IO objects as writable attributes, input/output can be more
easily simulated using StringIO or doubles.
2015-03-04 11:23:16 -08:00
edward010 51842623db Improved the package error message
The package error message will now show the actual package name if the
package already existed.
2015-02-27 10:41:04 +01:00
Tim Rensen 6c2cc31926 Fixed inaccurate downloading status message
Importing a base box from the local file system currently outputs 'Downloading: file://...' which is more accurate now by presenting it as: 'Unpacking necessary files from: file://...'.
Fixes #5386.
2015-02-25 20:37:54 +01:00
Mikhail Zholobov c4565b3c99 Create data dir only after the machine passes all checks 2015-02-12 14:32:16 +02:00
Mitchell Hashimoto a0be121f4f Revert "Merge pull request #5274 from mitchellh/sethvargo/atlas_api"
This reverts commit 7f19284ef4, reversing
changes made to f0284d000b.
2015-02-03 06:39:28 +01:00
Seth Vargo bec0f28f40 Use the new Atlas APIs for downloading boxes 2015-02-02 18:14:21 -05:00
Paul Hinze dfbcebef0b core: log action name to info
I found this output to be very helpful in debugging an action hook
problem in a plugin.  problem. I'm not sure why the callable_id is
useful (seem to always show up as an instance of `Builder` or `Warden`
for me), but I left it in there just in case it's useful to someone.
2015-01-24 09:59:48 -08:00
Seth Vargo 3f95d5de9f Merge pull request #5221 from simonvetter/svetter/fixBoxChecksums
fix checksum verification for downloaded boxes (fixes #4665)
2015-01-21 16:05:07 -05:00
Max Lincoln 853042f2fa Make sure allowed_synced_folder_types order overrides priority 2015-01-20 16:18:05 -05:00
Max Lincoln d781dce8f8 Filter synced folders by allowed_synced_folder_types 2015-01-20 16:18:05 -05:00
Simon Vetter 40eb978931 fix checksum verification for downloaded boxes (fixes #4665)
This makes sure that config.vm.box_download_checksum and
config.vm.box_download_checksum_type get passed to
Vagrant::Action.action_box_add with other options on
box download/import.
2015-01-20 14:28:29 +01:00
mbrodala cca19f8241 Check plugin name with version spec in has_plugin
If one passes a version spec to `Vagrant.has_plugin?`, the actual plugin name is ignored and any installed plugin which matches the version spec makes the check pass. Fix this by also checking for plugin name match in addition to the requested version spec.
2015-01-20 08:37:22 +01:00
Shawn Neal 522bf9ff8b Fix issue 3031
Sometimes in use ports can raise a Errno::EACCES exeptions on Windows hosts.
2015-01-16 08:03:37 -08:00
Seth Vargo a438e85418 Make with_clean_env a class method
Fixes #5021
2015-01-05 19:07:04 -05:00
Seth Vargo d2874064f4 Use .key? instead of .has_key? 2015-01-05 18:29:01 -05:00
Seth Vargo 2bd22c9663 Turn on Atlas debug logging if Vagrant is logging 2015-01-05 15:51:19 -05:00
Mitchell Hashimoto 6aeae27889 core: just don't use ** to avoid symbol/strings mixup
/cc @sethvargo
2015-01-05 12:37:58 -08:00
Mitchell Hashimoto c4502737c8 Revert "Symbolize and stringify keys in options hash"
This reverts commit 1699c92eec.
2015-01-05 12:35:31 -08:00
Seth Vargo 1699c92eec Symbolize and stringify keys in options hash 2015-01-05 10:48:39 -05:00
Mitchell Hashimoto 2385305f6f core: Don't encode! since string might be frozen 2014-12-10 09:27:00 -08:00
Seth Vargo 2e4f854725 Vagrant Cloud -> Atlas 2014-12-08 17:42:29 -08:00
Seth Vargo 6b48199346 Infer push name when only one strategy is defined, support multiple strategies 2014-12-08 11:35:15 -08:00
Seth Vargo c8bdf53c7e Rename push environment to env 2014-12-08 11:35:12 -08:00
Seth Vargo 35b7e28011 Do not use UNSET_VALUE in plugin (it uses components) 2014-12-08 11:35:11 -08:00
Seth Vargo 8e2f18761f Remove unused methods from vagrantfile.rb 2014-12-08 11:35:10 -08:00
Seth Vargo e5b10aa86b Collect push_configs in the Plugin Manager 2014-12-08 11:35:10 -08:00
Seth Vargo 413565f961 Simplify the API for Environment#push
The API has a precondition that `name` is not nil
2014-12-08 11:35:10 -08:00
Seth Vargo 3871154a74 Ignore options that come back from the plugin for now 2014-12-08 11:35:10 -08:00
Seth Vargo 988518a6ba Make Environment#pushes its own method 2014-12-08 11:35:10 -08:00
Seth Vargo 03b8105571 Super primitive implementation of Environment#push 2014-12-08 11:35:10 -08:00
Seth Vargo b6c5ca6b7a Add Push command and tests 2014-12-08 11:35:10 -08:00
Seth Vargo d79a0d52dd Do not use Enumerable in Registry
Calling methods like #first in Registry is misleading because it returns
a different result than registry.get(registry.keys.first).
2014-12-08 11:35:10 -08:00
Seth Vargo c0b107ff69 Add Registry#empty? to check if a registry has any items 2014-12-08 11:35:10 -08:00
Seth Vargo 2b03838fba Make Registry enumerable
Registry already responds to #each, so including the Enumerable module
gives us nice methods like #select and #collect fo' free!
2014-12-08 11:35:10 -08:00