Commit Graph

291 Commits

Author SHA1 Message Date
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 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 0c612f695f Util::ScopedHashOverride 2013-01-11 15:44:35 -08:00
Mitchell Hashimoto cf2c5a10c1 One more final fix for 1.8.7 2012-12-30 18:16:51 -10:00
Mitchell Hashimoto 037dbf24db Fix some failing tests for 1.8.7. 2012-12-30 18:13:27 -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 24c3c9a7ae Better test coverage on with_target_vms. Added pending tests to work on. 2012-12-30 10:59:59 -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 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 cd969e1e05 Remove the dotfile_name configuration option.
The dotfile is gone now so the configuration option is obselete
2012-12-26 21:45:24 -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 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 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 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 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 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 e2dd0b0cf2 Get machine tests passing again with new environment 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 5002b8d9c2 Fix failing test on 1.8.7 2012-12-20 22:05:05 -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 f52f8ecc97 Get tests passing again, use V2 config in tests. 2012-11-07 20:06:55 -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 253b433864 Support configuring the version for test plugins. 2012-11-06 21:32:26 -08:00
Mitchell Hashimoto 02e499da47 Update tests to create V2 plugins 2012-11-06 21:19:27 -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 efa0a6b8c2 Clean up tests a bit more 2012-11-04 08:10:48 -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 68923ff556 Additional tests for the plugin manager. 2012-11-03 21:30:22 -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
skim bad38ca935 fixes an exception issue when a non-directory appears in the boxes dir 2012-09-25 21:13:38 -05:00
Nate Smith 50c04ac927 `box.url` can use `file://` URI 2012-08-24 09:53:50 -04:00
Mitchell Hashimoto 1cdd69bc91 All tests passing 2012-08-19 19:17:19 -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 b659191a02 `vagrant up`! 2012-08-14 22:38:41 -07:00
Mitchell Hashimoto 85a499ffb8 Properly handle the case that VM doesn't exist for the VB driver. 2012-08-14 20:27:28 -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 296878cff5 Add basic loop detection for distro_dispatch 2012-08-12 19:03:22 -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 de0865b9e2 Test to ensure that the environment hash is returned from Machine#action
This will allow methods that call into the action to use any results
that might be set onto the environment hash by any of the middleware.
2012-08-11 20:33:09 -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 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 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 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
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 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 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