Commit Graph

2402 Commits

Author SHA1 Message Date
Mitchell Hashimoto 1505fc9d22 Autoload he port collision middleware 2013-02-27 13:37:50 -08:00
Mitchell Hashimoto 68aa9c8acf Output the UI when repairing port collisions 2013-02-26 13:43:06 -08:00
Mitchell Hashimoto 79609d42bb Additional options for the collision detection 2013-02-26 13:08:06 -08:00
Mitchell Hashimoto e97c330281 First pass at a forwarded port collision middleware 2013-02-26 12:10:26 -08:00
Mitchell Hashimoto 499d1ff8bf VAGRANT_VAGRANTFILE env var to specify alternate filename for Vfile 2013-02-23 12:07:23 -08:00
Mitchell Hashimoto 1bda157188 Only look for `Vagrantfile` if no more specific was given 2013-02-23 11:59:44 -08:00
Mitchell Hashimoto 60a1b035e7 For hooks, put the environment in the action env 2013-02-22 15:52:57 -08:00
Mitchell Hashimoto 3b2a82003e The hook callable has to be an Action builder so the hooks are called 2013-02-22 15:28:48 -08:00
Mitchell Hashimoto 29600d3d06 Always log the exception raised when error loading a plugin 2013-02-22 15:11:01 -08:00
Mitchell Hashimoto 1b6538354d Be smarter about determining if plugin load failed 2013-02-22 15:10:34 -08:00
Mitchell Hashimoto 9750069312 Better logging around environment hooks 2013-02-22 14:43:43 -08:00
Mitchell Hashimoto 46db50680b environment_unload hook 2013-02-22 13:54:28 -08:00
Mitchell Hashimoto 3c343c0623 Environment#hook allows hooks to be run at arbitrary points 2013-02-22 12:22:10 -08:00
Mitchell Hashimoto c68bf33d66 Specify action_name for all machine actions for action hooks 2013-02-22 12:14:15 -08:00
Mitchell Hashimoto be01d57034 action_hooks can hook into specific actions 2013-02-22 12:12:55 -08:00
Mitchell Hashimoto 18524628b7 Hooks allow parameters and blocks to middlewares 2013-02-22 12:00:35 -08:00
Mitchell Hashimoto 6a12edeb71 Get rid of unused variable 2013-02-20 20:41:19 -08:00
John Barney a390b9dddf Removing tabs added by a bad .vimrc 2013-02-10 03:49:15 -08:00
John Barney 73eb86bad0 Adding Cygwin detection, and fixing pathing issue in VirtualBox driver under Cygwin 2013-02-09 19:36:56 -08:00
Mitchell Hashimoto f837d32ae4 Rename FileUtil to Which since its too close to FileUtils 2013-02-08 22:29:53 -08:00
Mitchell Hashimoto 38e160055b Style nitpicks on FileUtil 2013-02-08 22:20:00 -08:00
Patrick Wyatt bd06bea3e5 Enable Windows users with SSH installed to use 'vagrant ssh' 2013-02-08 22:09:11 -08:00
Mitchell Hashimoto 595d6f7848 Record invalid key accesses as an error on config 2013-02-08 16:54:24 -08:00
Mitchell Hashimoto d659071a82 Check for NFS errors only if we actually have NFS folders 2013-02-08 16:25:41 -08:00
Mitchell Hashimoto 6afb4326fa Move NFS to a built-in middleware 2013-02-08 15:34:04 -08:00
Mitchell Hashimoto 050cb482f3 Better logging in the BoxAdd action 2013-02-07 18:19:42 -08:00
Mitchell Hashimoto 4144db5042 More gracefully handled plugins which cannot be found 2013-02-07 11:55:45 -08:00
Mitchell Hashimoto cd3d2a1e8c Call properly modifies original environment 2013-02-06 18:36:05 -08:00
Mitchell Hashimoto 4a1a990491 Raise a proper SSH error on ECONNRESET 2013-02-06 18:08:55 -08:00
Mitchell Hashimoto acbd024fa2 Put the machine action in the middleware env 2013-02-06 16:23:35 -08:00
Mitchell Hashimoto 1df4891371 Spread out methods in provision so subclass can override 2013-02-06 16:14:59 -08:00
Mitchell Hashimoto 352fec0359 Fix some issues to get hooks working 2013-02-06 15:42:48 -08:00
Mitchell Hashimoto b20dcc9eb8 Setup hooks in the runner 2013-02-06 15:37:12 -08:00
Mitchell Hashimoto aa7193471f Plugins can define action hooks via action_hook 2013-02-06 15:27:14 -08:00
Mitchell Hashimoto 83bba789a4 Hook#apply 2013-02-06 15:21:34 -08:00
Mitchell Hashimoto d720205810 Builder supports action hooks 2013-02-06 15:06:13 -08:00
Mitchell Hashimoto 9251b880f5 Addition docs on the hook class 2013-02-06 14:30:15 -08:00
Mitchell Hashimoto 80a7c8a0cb Hook class 2013-02-06 14:21:31 -08:00
Mitchell Hashimoto 8f24d2d98c Remove the "easy" plugins until a future version 2013-02-06 13:46:34 -08:00
Mitchell Hashimoto 87026b2d9e Remove old TOOD that was fulfilled 2013-02-05 22:17:00 -08:00
Mitchell Hashimoto 9f15fdeabc Only override the SSH host/user/etc if not specified by provider 2013-02-05 21:21:56 -08:00
Mitchell Hashimoto 79beefdb0a Do proper provider configuration merging 2013-02-05 12:22:00 -08:00
Mitchell Hashimoto 864f1b7506 Pass a proper Pathname for SSHExec to check key perms 2013-02-04 21:17:12 -08:00
Mitchell Hashimoto 434cc79a83 Properly expand config.ssh.private_key_path 2013-02-04 21:13:29 -08:00
Mitchell Hashimoto a72cfdbc00 Improved logging and such around SSH 2013-02-04 11:44:56 -08:00
Mitchell Hashimoto 82c9b658d0 Expose the home_path to the action runner 2013-02-04 10:42:44 -08:00
Mitchell Hashimoto b568ad0b8a Fix package to probably put output box in pwd 2013-02-04 10:38:50 -08:00
Mitchell Hashimoto 55c905b43b `vagrant plugin license` command. 2013-02-04 10:32:04 -08:00
Mitchell Hashimoto 7e71b73e4a Reformat some comments to be within 80 chars 2013-02-04 10:04:31 -08:00
Eric Tipton 421c2a9b2e fix args parser w/r/t ssh "-t" option -- it was failing b/c any associated shell commands need to be the last part of the system command 2013-02-04 06:16:32 -05:00
Mitchell Hashimoto 5d75a65382 Get rid of error "status codes" and just exit with 1 2013-02-03 18:04:43 -08:00
Mitchell Hashimoto 635949980b Handle the case a plugin install is a plugin not found 2013-02-03 14:29:29 -08:00
Mitchell Hashimoto 2079941e7d If the ID file doesn't exist, then don't delete it 2013-02-03 14:23:25 -08:00
Mitchell Hashimoto 01756dc964 Fix the UI so the output shows the proper machine name 2013-02-03 14:23:07 -08:00
Mitchell Hashimoto 78e9853b71 The resource in the UI doesn't show up if it is nil 2013-02-03 14:20:40 -08:00
Mitchell Hashimoto 3df6088db0 Make plugin loading more robust to errors 2013-02-03 14:13:27 -08:00
Mitchell Hashimoto 1162c2dbfc Instead of shelling out, use the RubyGems API to install plugins
This gets us an accurate name of the gem even if it is installed
from a file.
2013-02-03 13:59:43 -08:00
Mitchell Hashimoto 5882d5dad6 VAGRANT_NO_PLUGINS can be used to skip plugin loading 2013-02-03 13:03:00 -08:00
Mitchell Hashimoto 693b825eb1 Don't use the RC file, use the JSOn state file 2013-02-03 12:53:52 -08:00
Mitchell Hashimoto fa50f06a4c Error if RubyGems failed. 2013-02-02 23:31:53 -08:00
Mitchell Hashimoto a2ef7790de Start creating the plugin middleware sequences 2013-02-02 18:42:04 -08:00
Mitchell Hashimoto ec995b5ddf Avoid cross-device moves when adding boxes [GH-1350] 2013-02-02 16:37:46 -08:00
Mitchell Hashimoto 165dd63f78 New HandleBoxUrl built-in middleware to handlet the "box_url" config 2013-02-01 11:31:08 -08:00
Mitchell Hashimoto 4e6496bed7 Improve subprocess logging 2013-01-31 19:47:54 -08:00
Mitchell Hashimoto a8c7ad30ee Be a bit more fine grained about errors that are reported for Vfiles 2013-01-31 18:52:29 -08:00
Mitchell Hashimoto 67c2e205be Create rgloader/loader.rb files for encoded files 2013-01-31 18:48:56 -08:00
Mitchell Hashimoto 1392d9b4a5 Detect if a VM name is already taken for VirtualBox 2013-01-30 23:22:45 -08:00
Mitchell Hashimoto 7fe19d3a11 Use box directory as temporary directory to avoid cross-device [GH-1199] 2013-01-30 21:54:07 -08:00
Mitchell Hashimoto c164a5ca81 Merge pull request #1300 from kainz/master
Avoid cross device activity for box creation by creating tmp dir in provider dir
2013-01-30 21:47:40 -08:00
Mitchell Hashimoto c75ec09014 Lower IO.select timeouts to improve subprocess speeds
We were getting bit if the process exited while we were doing an
IO.select because it would then wait the full timeout.
2013-01-30 21:29:04 -08:00
Mitchell Hashimoto c5120fdd5e Don't fail too early with bad Vagrantfiles [GH-1345] 2013-01-30 20:16:10 -08:00
Mitchell Hashimoto e9327c4a28 Better logging in the config logger 2013-01-30 20:12:41 -08:00
Mitchell Hashimoto c57ba9de58 Give a nice human-friendly error message when problems loading Vfile 2013-01-30 20:01:41 -08:00
Mitchell Hashimoto 75ea4e5bdd --provision-with works properly again 2013-01-30 19:42:54 -08:00
Mitchell Hashimoto e0f0066c99 --no-provision works properly again 2013-01-30 19:39:21 -08:00
Mitchell Hashimoto 7eec127704 Support refreshing the machine cache 2013-01-30 10:37:40 -08:00
Mitchell Hashimoto 64042a5d35 Downloading the box_url component works again 2013-01-30 10:24:47 -08:00
Mitchell Hashimoto a21744a12d Merge pull request #1336 from ithinkihaveacat/return-non-zero-if-invalid-command
Return exit status of 1 on invalid command
2013-01-29 10:58:55 -08:00
Mitchell Hashimoto e1b78dbfbe Unlock the file explicitly due to some weirdness on BSD kernels 2013-01-28 21:08:22 -08:00
Mitchell Hashimoto 7531c94dbf Allow path and exception for Lock middleware to be procs 2013-01-28 20:46:39 -08:00
Mitchell Hashimoto 9ae3a373c8 Add new middleware builtin: Lock
This will do a process lock by flocking a file. If it fails, it will
raise an exception of choice.
2013-01-28 17:08:37 -08:00
Mitchell Hashimoto 0d27cd5bcb Warn if Vagrant is run outside of installers 2013-01-28 13:39:56 -08:00
Mitchell Hashimoto d4cf03d6c5 `vagrant package` uses bsdtar 2013-01-28 13:20:42 -08:00
Mitchell Hashimoto 35aef1aa0b Use bsdtar to repackage boxes 2013-01-28 13:18:07 -08:00
Mitchell Hashimoto e6a0023713 Switch to bsdtar for unpackaging a box 2013-01-28 13:01:43 -08:00
Michael Stillwell 7941748db7 Return exit status of 1 on invalid command
Makes "vagrant destroyjj" and similar return an exit code of 1, so that
"vagrant destroyjj && vagrant up" works as expected.
2013-01-27 19:52:43 +00:00
Mitchell Hashimoto c3cc513609 Create the setup_version file to track our directory layout version 2013-01-25 16:37:54 -08:00
Mitchell Hashimoto 6a3c0bd425 Call built-in supports args for imddleware 2013-01-22 12:20:02 -08:00
Mitchell Hashimoto fb875ab642 Better logging in the GracefulHalt middleware 2013-01-22 12:13:42 -08:00
Mitchell Hashimoto 51540496a9 GracefulHalt builtin 2013-01-22 11:56:49 -08:00
Mitchell Hashimoto e1f4e27b1b Update docs for v2 provider interface for MachineState 2013-01-21 11:44:19 -06:00
Mitchell Hashimoto 8ad8f73846 Raise an exception if a non-MachineState is returned 2013-01-21 11:31:20 -06:00
Mitchell Hashimoto 7bdf54923a Create the MachineState class 2013-01-21 11:25:28 -06:00
Mitchell Hashimoto 2d57afbbda Support warnings/errors when upgrading Vagrantfiles internally 2013-01-20 22:04:50 -05:00
Mitchell Hashimoto ffd9c1eb9c Verify we have errors to show if we're going to show them 2013-01-18 13:37:31 -08:00
Mitchell Hashimoto 7f55d5eac8 Builtin: ConfigValidate will validate your configuration 2013-01-18 13:26:14 -08:00
Mitchell Hashimoto 37e36010e0 Remove the ErrorRecorder 2013-01-18 13:15:22 -08:00
Mitchell Hashimoto fff021e51d Update Chef provisioner to new validation API 2013-01-18 13:12:02 -08:00
Mitchell Hashimoto e651eb3aa1 Add a V2 config helper to merge errors since that seems common 2013-01-18 13:03:07 -08:00
Mitchell Hashimoto 3f3c7027aa Machine objects are passed into validate instead of env 2013-01-18 12:43:53 -08:00
Mitchell Hashimoto a8b57ba13f Ignore empty error groups 2013-01-18 12:27:29 -08:00
Mitchell Hashimoto bae6555836 Remove DeprecationError 2013-01-18 12:23:29 -08:00
Mitchell Hashimoto e0c8fadae4 I can remove the `validate!` method from the v1 root 2013-01-18 12:18:30 -08:00
Mitchell Hashimoto 42a1ce6e9d Remove the old config validation error 2013-01-18 12:15:36 -08:00
Mitchell Hashimoto e6f9586d83 New validation method on the root that returns errors 2013-01-18 12:14:40 -08:00
Mitchell Hashimoto 0bd0752bf2 Environment#data_dir
This is basically a directory to store state.
2013-01-18 11:37:49 -08:00
Mitchell Hashimoto 776a1e446b Strip the value, actually, to trim the front newline 2013-01-15 21:57:10 -08:00
Mitchell Hashimoto 6c2e1c354f Chomp values inserted into a StringBlockEditor 2013-01-15 21:55:56 -08:00
Mitchell Hashimoto 23668d4ed0 Fix some newline weirdness with StringBlockEditor 2013-01-15 21:53:11 -08:00
Mitchell Hashimoto adec64baa4 Add the #get method to StringBlockEditor 2013-01-15 20:34:41 -08:00
Mitchell Hashimoto 335503a688 StringBlockEditor to help plugins with owning parts of files 2013-01-15 17:49:46 -08:00
Mitchell Hashimoto 5c9f27626c Provisioner built-in uses new API 2013-01-13 16:09:32 -08:00
Mitchell Hashimoto cf2cca3b7c Revamp the configuration internal state for defining provisioners 2013-01-13 16:02:48 -08:00
Mitchell Hashimoto c8053c00a4 New provisioner API. Shell provisioner adheres to it. 2013-01-13 15:48:52 -08:00
Mitchell Hashimoto 25fcb59e38 Use registries for the V2 plugin manager 2013-01-13 13:05:31 -08:00
Mitchell Hashimoto f3b340aae0 Use registry merging for provider configs 2013-01-13 13:00:06 -08:00
Mitchell Hashimoto 45879132a3 Registries support merging 2013-01-13 12:58:48 -08:00
Mitchell Hashimoto e66c5066e4 Plugin configuration can have scopes now, ex. provider 2013-01-13 12:38:17 -08:00
Mitchell Hashimoto 212e634c3b Make Provision a built-in action.
This allows other providers to just use it.
2013-01-12 16:22:37 -08:00
Mitchell Hashimoto 22571bf05b Rescue the EHOSTDOWN error for SSH 2013-01-12 12:47:49 -08:00
Mitchell Hashimoto 124a2ee5d3 Add the --provider optional flag to `box add` 2013-01-11 21:24:57 -08:00
Mitchell Hashimoto 48eaa93745 Raise proper error if there aren't any NIC slots available 2013-01-11 15:57:08 -08:00
Mitchell Hashimoto 102e8f23d6 Use scoped hash overrides for high-level config 2013-01-11 15:50:09 -08:00
Mitchell Hashimoto 0c612f695f Util::ScopedHashOverride 2013-01-11 15:44:35 -08:00
Bryon Roche b5c75b89a9 Make box creation not cross filesystems.
This will cause issues on modern linux which uses a tmpfs-backed tmpdir.
2013-01-07 16:19:17 -08:00
Mitchell Hashimoto f428b288f3 Convert provider to symbol only if non-nil 2012-12-30 18:08:07 -10:00
Mitchell Hashimoto 20253c4c4f Convert provider to symbol 2012-12-30 18:04:31 -10:00
Mitchell Hashimoto a30a92bb4f active_machines should return name as a symbol 2012-12-30 11:51:22 -10:00
Mitchell Hashimoto 4c46091746 Environment#primary_machine_name and use it for with_target_vms
This makes the single-provider and default provider semantics work with
primary VMs.
2012-12-30 11:12:56 -10:00
Mitchell Hashimoto 07157b47ae Only allow one provider active machine at a time.
Temporary limitation of Vagrant to only allow one active machine with a
provider at a time. That means you cant `up` a machine with both vmware
and virtualbox at the same time. In the future you will be able to but
to avoid various edge cases for now we're disallowing it.
2012-12-30 10:52:01 -10:00
Mitchell Hashimoto 526603dbbf Lots more logging in with_target_vms 2012-12-29 18:34:11 -10:00
Mitchell Hashimoto 9257fe3d98 Environment#active_machines
This returns a list of active machines for the environment. An active
machine is a machine that at one point was created by Vagrant.
2012-12-27 19:28:05 -10:00
Mitchell Hashimoto 4e649cc987 Upgrade V1-style dotfile to V2
See the code and comments for details on how this is done. As usual, we
are very careful about this so as not to inadvertently destruct real
user data.
2012-12-26 22:41:42 -08:00
Mitchell Hashimoto c0c3e7bf43 Remove Vagrant::DataStore
We just don't use it yet and the old implementation was sketchy. I was
not happy with it.
2012-12-26 21:45:24 -08:00
Mitchell Hashimoto b15a6dee0e Log more information about the machine 2012-12-26 21:45:24 -08:00
Mitchell Hashimoto 3baa31460f Store machine ID in "id" file in data directory.
Instead of storing an "active" hash in the local_data of an Environment,
we now place the ID of a machine in the "id" file of the machine data
directory. This file is read upon re-instantiation in order to load the
proper state.
2012-12-26 21:45:23 -08:00
Mitchell Hashimoto d18edc3ce5 Detect a V1 environment and stub upgrade process 2012-12-26 21:45:23 -08:00
Mitchell Hashimoto cc18492c7a Local data path introduced
The local data path is set to the `ROOT_DIR/.vagrant` by default and is
a directory where Vagrant can store environment-local state. This can be
overriden on a per-Environment basis using the `local_data_path`
option.
2012-12-26 21:45:23 -08:00
Mitchell Hashimoto 5cb2f3275a Get rid of a silly constant for subdirs in Environment
The data is only used once anyways so just use a local variable.
2012-12-26 21:45:23 -08:00
Mitchell Hashimoto 8fe0f86dbd The --provider flag for `up` now actually does something. 2012-12-23 21:23:08 -08:00
Mitchell Hashimoto 3808ea377f Upgrade all other default configurations to V2 2012-12-23 16:29:26 -08:00
Mitchell Hashimoto b0b7c56aa3 More accurate commenting/documentation on the command helpers 2012-12-23 16:29:25 -08:00
Mitchell Hashimoto e88d735cb6 Make configured VM providers default to an empty one 2012-12-23 16:29:25 -08:00
Mitchell Hashimoto 6478139cee Move config.vm.customize to VirtualBox specific option 2012-12-23 16:29:25 -08:00
Mitchell Hashimoto dffbf6eb09 Allow COnfirm calls to be forced by specifying a force_key 2012-12-23 16:29:25 -08:00
Mitchell Hashimoto 50d7b0aba4 Fix bug where Call didn't propagate recovery. Warden has no recovery.
The issue here is that when a middleware failed and a recovery sequence
started, it would halt at the "call" step because the "Call" didn't
properly recover the child sequence.

An additional issue was that a Warden had no "recover" method, meaning
embedded Wardens wouldn't recover their stacks properly.
2012-12-23 16:29:25 -08:00
Mitchell Hashimoto a6e0d3908f Create a "dummy" provider for tests 2012-12-23 16:29:24 -08:00
Mitchell Hashimoto ac7958a43b Environment#primary_machine takes a provider argument. Use it. 2012-12-23 16:29:24 -08:00
Mitchell Hashimoto 128c06e78d Environment#default_provider 2012-12-23 16:29:24 -08:00
Mitchell Hashimoto 1ee470a551 Begin work on supporting provider-specific configuration
This works by registering a `config` with `:provider => true` with the
same name as your provider. Vagrant will then automatically configure
the provider when `config.vm.provider` is used.
2012-12-23 16:29:24 -08:00
Mitchell Hashimoto 99c5cddb7d V2 config supports the concept of an "UNSET" value when doing merges
This value should be used as a default, and allows the parent `merge`
method to "just work" most of the time.
2012-12-23 16:29:24 -08:00
Mitchell Hashimoto 2da812bd48 Change log levels of some messages that are useful 2012-12-23 16:29:24 -08:00
Mitchell Hashimoto e16010041a Warden only logs an error once 2012-12-23 16:29:24 -08:00
Mitchell Hashimoto cc24d7b196 Better logging for the box collection 2012-12-23 16:29:24 -08:00
Mitchell Hashimoto c9d5cff7be Add in some logging 2012-12-23 16:29:23 -08:00
Mitchell Hashimoto 819140bbc2 Don't error if box doesn't exist on load 2012-12-23 16:29:23 -08:00
Mitchell Hashimoto 0ec639c8e1 BoxCollection#find should only find V1 box when searching for vbox 2012-12-23 16:29:23 -08:00
Mitchell Hashimoto f2b91d26fd Load the configuration per machine, so that provider boxes work
Boxes are provider-specific, and we don't know the provider until
Environment#machine is called, so we need to build up the machine
configuration during this time.
2012-12-23 16:29:23 -08:00
Mitchell Hashimoto 0180ed849d Move config loader order out from an ivar into a param for the #load
method
2012-12-23 16:29:23 -08:00
Mitchell Hashimoto 1559f7b7a7 Get rid of the old Environment#vms calls. Use #machine everywhere. 2012-12-23 16:29:23 -08:00
Mitchell Hashimoto 130a602e9b Style nitpick 2012-12-16 10:40:12 -08:00
Nate Smith d556c0006c Update lib/vagrant/plugin/v2/plugin.rb
Require set in the V2 plugin file since it uses it.

Fixes #1257
2012-12-11 15:51:35 -05:00
Mitchell Hashimoto d84b71d73e Require set in the V1 plugin file since it uses it. 2012-12-01 11:28:31 -08:00
Mitchell Hashimoto b416665fd7 Just some comments 2012-11-07 22:21:48 -08:00
Mitchell Hashimoto 2ef6ff10f0 Cache the machine objects created in Environment#machine.
Each machine and provider backing should be represented by only one
machine.
2012-11-07 22:08:06 -08:00
Mitchell Hashimoto 67855be77b Add the Environment#machine method
This will eventually replace the Environment#vms method. Because of the
introduction of providers, the environment doesn't know what the backing
of the machines will be (and they're _machines_ now, not _vms_).
Instead, users of Environment will now call `#machine` on the
environment to retrieve a machine with the given backing provider as it
needs it.
2012-11-07 21:45:09 -08:00
Mitchell Hashimoto 53860f90ab V2 loader now properly upgrades V1 configuration.
This is done by calling the `upgrade` method on the _old_ configuration
classes. The old configuration classes are given the complete new
configuration and can set whatever settings they need to on it.
2012-11-07 20:01:39 -08:00
Mitchell Hashimoto d254d6f718 Configure the V2 kernel. 2012-11-06 21:28:44 -08:00
Mitchell Hashimoto 81ca275792 Providers to V2 2012-11-06 21:20:55 -08:00
Mitchell Hashimoto 5a33b7ee54 Hosts to V2 2012-11-06 21:20:22 -08:00
Mitchell Hashimoto 1d2beff649 Guests to V2 2012-11-06 21:14:45 -08:00
Mitchell Hashimoto 45f211b19e Communicators to v2 plugins. 2012-11-06 21:14:10 -08:00
Mitchell Hashimoto 78a1e5726e Get rid of some ruby warnings due to shadowed variables 2012-11-06 21:12:15 -08:00
Mitchell Hashimoto e8370f0098 Convert comands to V2 plugins. 2012-11-06 21:09:29 -08:00
Mitchell Hashimoto be294e002a Build the v2 interface, which is just a copy of V1 for now. 2012-11-06 20:51:03 -08:00
Mitchell Hashimoto 0ca783e8d1 V1 config loader loads upgradable config if not V1
This is to prepare for the upcoming V2 configuration. When we're in V2,
we only want to load _upgradable_ configuration keys.
2012-11-03 21:54:32 -07:00
Mitchell Hashimoto 59d5c5ed92 Add support for "upgrade safe" config classes to plugins.
These are classes that use NO core classes of Vagrant, and are therefore
safe to load for upgrades. i.e. a V2 core can load a V1 config class
that is deemed upgrade safe without crashing Vagrant.
2012-11-03 21:39:06 -07:00
Mitchell Hashimoto c803b0508a Much cleaner plugin part querying syntax.
Before we were manually going over every plugin and getting each piece,
all over the place. Now we have a central manager that will give us all
the pieces we want. There is still some cleanup to do here but this is
much better overall.
2012-11-03 21:25:28 -07:00
Mitchell Hashimoto 6ca671e2b8 Don't allow registry to be given value in non-block form 2012-11-03 20:46:24 -07:00
Mitchell Hashimoto 6df6f6764f Remove plugin activation. It really isn't necessary.
It was only used in a couple places and it isn't necessary since you can
do the loading within the actual blocks themselves.
2012-11-03 20:29:34 -07:00
Mitchell Hashimoto 32d5599e72 Document the box collection format a bit more 2012-09-27 11:57:40 -07:00
Mitchell Hashimoto 1360d86747 Use `next` over select with symbol to proc 2012-09-27 11:52:03 -07:00
skim bad38ca935 fixes an exception issue when a non-directory appears in the boxes dir 2012-09-25 21:13:38 -05:00
Mitchell Hashimoto bb56f4dd31 Clean up logic surrounding file downloader matching 2012-09-09 20:31:17 -07:00
Mitchell Hashimoto e0e2cc1974 Merge pull request #1087 from nwjsmith/master
Allow `file://` URIs from `config.box.url`
2012-09-09 20:28:19 -07:00
Mitchell Hashimoto 7158445c2d Error message on ECONNRESET for box downloading via HTTP [GH-1090] 2012-09-09 20:16:43 -07:00
Nate Smith 50c04ac927 `box.url` can use `file://` URI 2012-08-24 09:53:50 -04:00
Mitchell Hashimoto ba0e426507 Get vagrant package --base working in some hacky way.
`vagrant package --base` is deprecated for a future feature so I didn't
want to waste any brain cycles on how to do this the "right" way since a
new system will be introduced to do this sort of thing in teh future.
2012-08-19 18:51:36 -07:00
Mitchell Hashimoto cc7768c535 Trivial whitespace changes 2012-08-18 20:06:50 -07:00
Mitchell Hashimoto a7b298b647 Remove Vagrant::VM 2012-08-18 19:36:50 -07:00
Mitchell Hashimoto 78d79de5c4 Comment the action_box_add method 2012-08-18 16:19:13 -07:00
Mitchell Hashimoto 47fe278667 `vagrant box add` works again. Box verification remove temporarily.
The built-in middleware sequences will now be hardcoded onto
Vagrant::Action. Other plugins can hook into these sequences to provide
verification and so on. So the VirtualBox plugin will hook into that
action sequence and add verification.
2012-08-18 16:13:14 -07:00
Mitchell Hashimoto fa4cf63462 Remove the actions that are unavailable now from autoload 2012-08-15 21:55:47 -07:00
Mitchell Hashimoto fcffcb2ee0 Delete more unused actions 2012-08-15 21:55:25 -07:00
Mitchell Hashimoto ef5eabb63d Remove the builtin VM middleware that are now part of the VB provider 2012-08-14 22:39:25 -07:00
Mitchell Hashimoto b659191a02 `vagrant up`! 2012-08-14 22:38:41 -07:00
Mitchell Hashimoto 2fc18f7207 `destroy` gets a little farther, and properly halts the VM 2012-08-13 23:18:50 -07:00
Mitchell Hashimoto bca8663742 `vagrant resume` works with the new machine abstraction 2012-08-13 20:03:35 -07:00
Mitchell Hashimoto 83b908f3d8 `vagrant suspend` works with new machine abstraction 2012-08-13 19:30:41 -07:00
Mitchell Hashimoto 296878cff5 Add basic loop detection for distro_dispatch 2012-08-12 19:03:22 -07:00
Mitchell Hashimoto 0eddda3552 Halt works with new machine.
This required some modifications to the linux guest implementation. And
the other guests will have to be modified as well. This is because
`channel` is now `communicate`.
2012-08-12 18:54:52 -07:00
Mitchell Hashimoto f9752d78d8 Properly resolve and load the guest class impl for Machines 2012-08-12 18:35:19 -07:00
Mitchell Hashimoto 28f341ec75 Begin working on the #guest method for Machine instances 2012-08-12 16:46:00 -07:00
Mitchell Hashimoto 5e70ad0ec2 `vagrant ssh -c` now uses a middleware sequence 2012-08-10 00:57:23 -07:00
Mitchell Hashimoto 2e25285297 Add nice inspect results for Environment and Machine 2012-08-10 00:38:11 -07:00
Mitchell Hashimoto 64afd578b3 Just always return the SSH communicator for machines for now.
In the future we'll actually find a matching communicator but for now
since we're just focusing on machine abstraction, we just return SSH.
2012-08-08 21:57:08 -07:00
Mitchell Hashimoto 5ae3e0e80c Allow the definition of communicators in plugins 2012-08-08 21:52:25 -07:00
Mitchell Hashimoto 595e7cee0e Move SSH communication to a plugin 2012-08-08 21:48:51 -07:00
Mitchell Hashimoto a1cef830e3 Add the Communicator plugin API.
This allows communication protocols to be defined for the machine. This
is how things like SSH will be implemented.
2012-08-08 21:28:28 -07:00
Mitchell Hashimoto b1ced46d7c SSHExec raises proper exception if SSH is not yet ready 2012-08-06 10:29:25 -07:00
Mitchell Hashimoto 8d50c4774e Tests for SSHExec, and forward in the ssh options 2012-08-05 18:37:41 -07:00
Mitchell Hashimoto e0ec679838 `vagrant ssh` with full console works with new provider.
This works by now calling the `:ssh` action on the provider. This action
is allowed to do whatever it pleases, but should at some point probably
call the `SSHExec` built-in middleware.

The `SSHExec` built-in middleware was added. This uses the information
returned by `Machine#ssh_info` and uses the `Vagrant::Util::SSH` helper
to exec into the remote machine. The provider should do any work upfront
in verifying that the machine is ready to be SSHed into.
2012-08-05 13:45:24 -07:00
Mitchell Hashimoto a1145615d0 Machine#action supports passing in extra env vars for action runner 2012-08-05 13:16:08 -07:00
Mitchell Hashimoto 984c4f4025 Add Util::SSH which has methods for checking key permissions and exec 2012-08-05 13:12:53 -07:00
Mitchell Hashimoto 1a2a8b49c0 Provider API to return SSH info, must implement `ssh_info`.
Since SSH is such a critical part of Vagrant, each provider must
implement a method that returns the proper way to SSH into the machine.
2012-08-05 12:41:05 -07:00
Mitchell Hashimoto 9db982f7a4 Expose the provider via the machine object. 2012-08-04 11:16:31 -07:00
Mitchell Hashimoto d8cb02d55d Load the machine ID prior to initializing the provider 2012-08-03 14:22:17 -07:00
Mitchell Hashimoto e5f250121a Call now only yields the environment 2012-07-27 19:34:46 -07:00
Mitchell Hashimoto 118377e6f0 Destroy sequence asks the user for confirmation. 2012-07-27 19:29:40 -07:00
Mitchell Hashimoto e20326d577 Added the Confirm built-in middleware
This middleware asks the user a question and expects a Y/N answer. This
middleware can be used with the Call middleware.
2012-07-27 19:16:44 -07:00
Mitchell Hashimoto 556a53d48d You can no longer set env vars on Builders via `use` 2012-07-27 19:05:35 -07:00
Mitchell Hashimoto 90517a0f9b The `Call` built-in middleware allows for conditional MW sequences.
Read the documentation for more information.
2012-07-26 23:56:47 -07:00
Mitchell Hashimoto 5eed3b8417 Building up the `destroy` action again using new provider API.
This shows me moving the built-in middleware sequences to the provider
and how I'm organizing all that.
2012-07-26 22:39:27 -07:00
Mitchell Hashimoto 5f8a654393 Goodbye, instance_eval on Vagrant::Action::Builder! 2012-07-26 22:00:25 -07:00
Mitchell Hashimoto 2ef20586da Remove the action registry feature.
This can be removed since in the future all actions will come from the
providers or something. There are still issues with box actions but
we'll get back to that later...
2012-07-26 21:57:11 -07:00
Mitchell Hashimoto 44b4b9dfef Move drivers to the VirtualBox plugin. Use Machine class.
This starts the transition of replacing VM with Machine. Machine still
isn't ready to fully replace VM but by moving it now, I'm able to find
the spots that need to be fixed. At this point `vagrant status` works
with the new provider interface.
2012-07-24 21:32:38 -07:00
Mitchell Hashimoto 912998ef31 Fill in the provider API a bit more to what it is. 2012-07-16 15:24:51 -07:00
Mitchell Hashimoto aef2c5f48e Logging statements to Vagrant::Machine 2012-07-16 14:21:51 -07:00
Mitchell Hashimoto 8f0375d7f3 Machines can call actions on their providers. 2012-07-16 14:12:58 -07:00
Mitchell Hashimoto 8fc5591b8e Machine queries state from the provider 2012-07-16 10:57:17 -07:00
Mitchell Hashimoto 353610021c Vagrant::Machine
This is the class that will represent a machine that is managed by
Vagrant. The class has a number of attributes associated with it and is
meant to be a single API for managing the machines.
2012-07-16 10:28:42 -07:00
Mitchell Hashimoto 3519bf0372 Add the "provider" API to the V1 plugin. 2012-07-15 11:17:58 -07:00
Mitchell Hashimoto 436da57cc4 Add the #action API to the provider plugin 2012-07-14 17:04:06 -07:00
Mitchell Hashimoto 3b82f2efc4 Create the basic provider plugin interface.
Non-functional at this point.
2012-07-14 16:57:54 -07:00
Mark LaPerriere 28e19d5449 Update load_plugins to be more Windows friendly. Uses File::PATH_SEPARATOR instead of hard-coded colon (':'). 2012-07-12 15:25:28 -03:00
Mitchell Hashimoto 690d380b77 Use the new BoxCollection API 2012-07-11 18:41:13 -07:00
Mitchell Hashimoto f20666e230 Automatically upgrade the boxes all over. 2012-07-11 18:36:23 -07:00
Mitchell Hashimoto bcd1304ef4 Remove unused middleware sequences related to repackaging 2012-07-11 18:36:23 -07:00
Mitchell Hashimoto cc076e5ee5 Box#repackage to repackage a box. 2012-07-11 18:36:22 -07:00
Mitchell Hashimoto 798ffc93bd BoxCollection#add throws an UpgradeRequired exception if a V1 box
already exists
2012-07-11 18:36:22 -07:00
Mitchell Hashimoto 1d197d84c3 BoxCollection#add transparently upgrades V1 boxes to V2
This means that V1 boxes can be added to a V2 box collection without
issue.
2012-07-11 18:36:22 -07:00
Mitchell Hashimoto 8026715619 Remove the box_remove builtin middleware sequence. 2012-07-11 18:36:22 -07:00
Mitchell Hashimoto 6bb621026f `vagrant box add` uses the new API.
This assumes VirtualBox boxes for now, which is fine.
2012-07-11 18:36:22 -07:00
Mitchell Hashimoto 623ecb3e3d Environment attempts to upgrade box on config load.
If a V1 box is encountered when Vagrant loads the configuration, then it
will be upgraded on the fly.
2012-07-11 18:36:22 -07:00
Mitchell Hashimoto 7595f0078e BoxCollection#add provider argument is optional
In the case that not provider is given then whatever provider the box
represents will be added to the system. Ideally, a provider will be
given, but if not, Vagrant still does a "best effort" to install the
box.
2012-07-11 18:36:22 -07:00
Mitchell Hashimoto da15105a8f Make Box2 the new Box
This involved defaulting all box searching at the moment to VirtualBox.
Additionally, box upgrading is not yet handled. This needs to be done at
some point.
2012-07-11 18:36:21 -07:00
Mitchell Hashimoto e7bed7c2ff Raise an exception if an invalid tar file is added. 2012-07-11 18:36:21 -07:00
Mitchell Hashimoto a35f6a175d Exception when you attempt to add a box when a V1 box conflicts. 2012-07-11 18:36:21 -07:00
Mitchell Hashimoto 9e33d16ca1 Adding a box that already exists should result in an exception. 2012-07-11 18:36:21 -07:00
Mitchell Hashimoto 9cb0015b6e Test that an added box provider must match expected. 2012-07-11 18:36:21 -07:00
Mitchell Hashimoto c2151681ec Box collection can add a new box. This is the happy path only. 2012-07-11 18:36:21 -07:00
Mitchell Hashimoto e647afc7d2 Add logging statements to the box upgrade process. 2012-07-11 18:36:21 -07:00
Mitchell Hashimoto ffd5ac5af4 BoxCollection can now upgrade V1 boxes to V2 2012-07-11 18:36:21 -07:00
Mitchell Hashimoto 2eaa850853 Box2 reads the metadata.json file. 2012-07-11 18:36:21 -07:00
Mitchell Hashimoto 4386ff9887 BoxCollection#all returns all boxes, including V1 boxes 2012-07-11 18:36:20 -07:00
Mitchell Hashimoto 9d1924811e Box collection can detect V1 boxes and throws an exception
The exception notifies the caller that the box needs to be upgraded. The
upgrade process is not yet done but is coming ina  future commit.
2012-07-11 18:36:20 -07:00
Mitchell Hashimoto a6d7bd48fd Find boxes with new on-disk structure.
The box collection can now find new-style boxes with providers and
return proper Box objects. In the future, we'll also have to implement
upgrading old style ones as well.
2012-07-11 18:36:20 -07:00
Mitchell Hashimoto 42826356ad Basic "Box2" implementation.
This is the beginning of the new box internals. The basic idea is that
the new box has a new field: provider. The provider will describe what
provider that box was built with and what provider it is made to work
with.
2012-07-11 18:36:20 -07:00
Mitchell Hashimoto a34801588c Handle the case where ctrl-D is pressed on input. 2012-07-11 18:30:37 -07:00
Mitchell Hashimoto 61621369d2 Catch Net::SSH::Disconnect when connecting to SSH
This error was experienced by @pearkes. It is thrown when the remote end
unexpectedly closes the remote end. This is usually caused by SSH not
being able to properly setup the connection.
2012-07-04 08:26:09 -10:00
Mitchell Hashimoto ef265ab3ba Disable read timeout for HTTP downloader 2012-06-28 21:28:40 -07:00
Mitchell Hashimoto 5bc0fa1dff Default the IO.select result to empty array to avoid nil errors 2012-06-28 08:22:06 -07:00
Mitchell Hashimoto 0b9173efd9 Handle case that `writers` is nil on IO.select in subprocess
This can happen when IO.select timeout is reached when we're listening
for writers.
2012-06-27 13:54:05 -07:00
Mitchell Hashimoto 0b3e703498 Add the gateway to hostonly network interfaces on Debian [GH-990] 2012-06-27 11:18:23 -07:00
Mitchell Hashimoto 134e56db21 Reference proper constant ALL_ACTIONS 2012-06-27 11:16:04 -07:00
Mitchell Hashimoto 70bdd9f56e Move host base class to a plugin component 2012-06-27 09:26:03 -07:00
Mitchell Hashimoto 214b29888a Remove the old guest base 2012-06-26 16:29:53 -07:00
Mitchell Hashimoto 53d8c28c8e Move guests to Vagrant.plugin("1", :guest) 2012-06-26 16:28:49 -07:00
Mitchell Hashimoto b23dda54b8 Move command base class to a plugin component 2012-06-26 16:18:02 -07:00
Mitchell Hashimoto 7258daf535 Support specifying a component for Vagrant.plugin
The future of subclassing things like configuration bases and so on will
be to use `Vagrant.plugin(version, component)`. For example:
`Vagrant.plugin("1", :provisioner)`.
2012-06-26 15:47:26 -07:00
Mitchell Hashimoto 2e00a007ce Move provisioner superclass into the V1 namespace 2012-06-26 15:06:04 -07:00
Mitchell Hashimoto 798704c6d2 Move the loader into the Config::V1 namespace. 2012-06-26 15:06:03 -07:00
Mitchell Hashimoto 41bc8e7454 Move Config::V1::Base to Vagrant::Plugin::V1::Config 2012-06-24 17:06:11 -07:00
Mitchell Hashimoto ffab8cab68 Renamespace V1 plugin root to Vagrant::Plugin::V1::Plugin
This is mostly a transparent change to end users, but I'm going to put
all base classes for V1 into Vagrant::Plugin::V1.
2012-06-24 14:24:52 -07:00
Mitchell Hashimoto 6231bef3f0 Simple logging text change 2012-06-23 23:40:55 -07:00
Mitchell Hashimoto 7a299ae2de Configuration loader can handle upgrading.
The basic process for this is to:

1. Load the configuration using the proper loader for that version. i.e.
   if you're loading V1 config, then use the V1 loader.
2. If we just loaded a version that isn't current (imagine we're
   currently at V3), then we need to upgrade that config. So we first
   ask the V2 loader to upgrade the V1 config to V2, then we ask the V3
   loader to upgrade the V2 config to V3. We keep track of warnings and
   errors throughout this process.
3. Finally, we have a current config, so we merge it into the in-process
   configuration that is being loaded.
2012-06-23 19:56:31 -07:00
Mitchell Hashimoto 9bc1ea5f04 Use config finalize to move some version-specific logic to the version
This moves out the concept of a "default VM" from the Environment class
and makes it the responsibility of the V1 configuration that at least
one VM is defined on it. This lets the configuration ultimately decide
what a "default" implementation is.
2012-06-23 12:48:53 -07:00
Mitchell Hashimoto 70fb804128 Configuration versions can finalize config after loading
This is useful so that it can take a look at the final loaded
configuration object and possibly make some tweaks to the configuration
object. The use case this was built for was so that config V1 can verify
that there is always at least a single VM defined as a sub-VM, the
"default" VM.
2012-06-23 12:27:32 -07:00
Mitchell Hashimoto 7e19d6849b Config loader no longer assumes latest version for procs.
Previously, all procs were assumed to just be the current version. This
is certainly not going to be true always so now the version number of
the configuration must be explicit if you're assigning a proc to the
configuration loader.
2012-06-23 12:06:54 -07:00
Mitchell Hashimoto b3db82e516 Separate out the versions the config loader knows as init params.
This means that the Config::Loader now only knows how to load
configuration for versions used to initialize the class. This lets
things like the tests be completely isolated from what the actual
configuration is for Vagrant. This will be immensely useful to verify
that the loader functionality works for non-trivial bits (like
upgrading) without depending on Vagrant's upgrading functionality.
2012-06-23 11:33:53 -07:00
Mitchell Hashimoto a677c15e86 Use `next` instead of `return` for 1.8.x compatibility.
Since we're not calling this lambda from inside a method, the `return`
causes a LocalJumpError on 1.8.x. It appears this functionality works
fine on 1.9.x but we'd like to support both. The correct behavior
appears to use `next`.
2012-06-23 10:47:01 -07:00
Mitchell Hashimoto ba64c28304 Convert the path to a string because it may be a Pathname 2012-06-22 21:06:49 -07:00
Mitchell Hashimoto fa99eb7e54 Check for permission denied when using SCP to upload [GH-924] 2012-06-22 21:04:21 -07:00
Mitchell Hashimoto d8c16035c8 Don't use Pathname#each_child for 1.8.7 compat [GH-979]
each_child is a 1.9.x feature. The implementation however is simple
enough that I copied it over and just use the 1.8.7 compatible version.
2012-06-22 20:47:43 -07:00
Mitchell Hashimoto 51be92eeb6 Remove dependence on V1 Kernel from Environment 2012-06-14 18:46:48 -07:00
Paul Morton 922a5aade5 Update drivers to support reading MAC Addresses 2012-06-11 21:29:21 -07:00
Matt Robenolt db76b42ef5 Allow the .vagrant dotfile to be moved into a completely different directory tree
I wanted to define my dotfile as: `config.vagrant.dotfile_name =
"~/.vagrant-projectname"` and noticed that the full path wasn't
expanded as expected.

This patch allows the vagrant file to be placed anywhere on the
filesystem.
2012-06-09 22:56:54 -07:00
mxtthias 447d6810f7 Explicitly tell ssh server we're done sending data 2012-06-08 14:40:49 +02:00
Mitchell Hashimoto b393de052f Subprocess now only yields stdout/stderr if you're listening 2012-06-01 23:17:48 +02:00
Mitchell Hashimoto 2441961a34 Fix bug where SSH didn't work properly
Forgot to set the `shell` variable properly
2012-06-01 23:17:38 +02:00
Mitchell Hashimoto 1a6ae81aa9 Require what to be notified for with block and Subprocess.execute
There was an issue before where the stdin buffer would always have space
so it would always yield that block and Ruby would spin at 100%. Now we
require all callers to say what they want to listen for. This drops
CPU down to almost nothing.

See GH-832
2012-06-01 17:02:12 +02:00
Mitchell Hashimoto 903fd3acdc Easy operations API `local` now echoes stdout/stderr 2012-06-01 16:38:40 +02:00
Mitchell Hashimoto ca6d49bc94 Easy operations `run` and `sudo` now echo stdout/stderr 2012-06-01 16:33:41 +02:00
Mitchell Hashimoto f133f39bcc Add comment to explain unclear code 2012-06-01 16:08:41 +02:00
Mitchell Hashimoto fd9ad904fe Easy commands now take a target VM name
It is assumed to be the first arg, as long as the first arg doesn't
begin as a flag "-foo"
2012-06-01 15:59:05 +02:00
Mitchell Hashimoto 83917a6bb0 Added `arg` and `arg_extra` API to easy commands
Easy commands can now easily get arguments from the command line.

Using `arg`, you can get named arguments on the command line, such as
"--foo" or "-f"

With `arg_extra`, you can get any remaining arguments after a "--"
on the command line, which is a common pattern used to grab longer
parameters.
2012-06-01 15:57:55 +02:00
Mitchell Hashimoto 100e1f7eb0 Primary VMs are respected again.
At some point in the past, primary VMs were no longer respected for
commands. This fixes taht.
2012-06-01 15:10:26 +02:00
Mitchell Hashimoto 9cb53860c2 New easy command APIs: argv, info, error, success
Some new APIs were added to the easy command operations. `info`,
`error`, and `success` are simple ways to output messages to the UI
without resorting to "puts" in Ruby, since the Vagrant UI object is the
idiomatic way to do communication with the world.

Additionally, `argv` was added which gives commands access to the
command-line arguments that are remaining that does not include the
vagrant binary or subcommand.

Also, behavior was changed: Previously, easy commands would run for
every target VM. Now, it is only run once with the primary VM. In the
next commit, I plan on adding a new flag that signifies an easy command
is meant to work with a named VM.
2012-06-01 14:55:08 +02:00
Mitchell Hashimoto 1ef679f683 SSH log level fatal. Thanks @petejkim
This change makes it so that SSH errors are shown, whereas QUIET hid
those as well. The main change to QUIET was to get rid of warnings,
not errors, so this fixes that.
2012-05-31 23:42:28 +02:00
Zsolt Takács cac79cf409 preserve attributes on packaging when using ruby 1.9.2
see http://bugs.ruby-lang.org/issues/4507
2012-05-26 16:51:18 -07:00