Commit Graph

1456 Commits

Author SHA1 Message Date
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 e822aac931 Convert builder tests to use rspec "subjects" 2013-02-06 14:25:36 -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 84ded8d67e Fix machine ssh_info tests 2013-02-05 21:27:26 -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 c57ba9de58 Give a nice human-friendly error message when problems loading Vfile 2013-01-30 20:01:41 -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 3399b74163 Fix invalid box test by not relying on Archive;:Tar::Minitar 2013-01-29 11:10:44 -08:00
Mitchell Hashimoto 948a31d7b3 Merge pull request #1326 from lolindrath/master
Add test for invalid box file
2013-01-29 11:09:05 -08:00
Mitchell Hashimoto 2073ce697f Move cli test to proper path 2013-01-29 11:00:56 -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 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 64af19c783 Remove archive::tar::minitar from tests 2013-01-28 13:28:40 -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 6a3c0bd425 Call built-in supports args for imddleware 2013-01-22 12:20:02 -08:00
Mitchell Hashimoto 51540496a9 GracefulHalt builtin 2013-01-22 11:56:49 -08: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
Andy Williams 8a8b771e0a Add test for invalid box file
Filled in pending test. It creates a valid tar file, over-writes the
checksum field in the tar's header and then checks that the
BoxUnpackageFailure exception is thrown.
2013-01-20 14:28:48 -05: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 a8b57ba13f Ignore empty error groups 2013-01-18 12:27:29 -08:00
Mitchell Hashimoto e6f9586d83 New validation method on the root that returns errors 2013-01-18 12:14:40 -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 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
Mitchell Hashimoto 5cf737d4fc Remove the buildbot stuff, we'll move away from it. 2012-11-03 13:47:57 -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
Mitchell Hashimoto cd6c60775c Use the V1 box helper for a test. 2012-07-11 18:36:20 -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 70bdd9f56e Move host base class to a plugin component 2012-06-27 09:26:03 -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 194cd2145d Fix some nondeterminism in tests with GCing tempfiles.
Before, the tempfile "f" could be GC'd before the path was used,
resulting in failed tests because when it is GC'd the tempfile is
removed. We now store the tempfile in an instance variable so that it
isn't even available for GC until after the test is finished running.
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 f26024f771 Test Tempdir class cleans itself up 2012-06-24 00:03:28 -07:00
Mitchell Hashimoto 37c54c7b20 Use a temporary directory for the VAGRANT_CWD when running tests
Tests before were picking up a Vagrantfile in the Vagrant source
directory, which can cause some funny failures. This ensures that each
test run will actually establish a new temporary CWD so that a
Vagrantfile is hopefully never found.
2012-06-23 23:56:39 -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 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 de78a3637a Plugin activation
Vagrant is only guaranteeing that the plugin definition superclass (the
Vagrant.plugin("1") part) is backwards compatible. Anything else, such
as Vagrant::Command::Base and so on, will likely change in future
versions. Beacuse of this, plugins should only immediately expose their
definition.

In order to support loading the other classes, plugins should defer
loading to the "activation" phase of a plugin. This can be done using
the `activated` block:

    class MyPlugin < Vagrant.plugin("1")
      name "my plugin"

      activated do
        require "myplugin/my_command"
      end

      command("foo") { MyCommand }
    end

Plugin activation is done at two specific times:

  * Right when a Vagrant::Environment is created and the global plugins
    (such as from ~.vagrantrc) are loaded.
  * Right before loading configuration, but after the Vagrantfiles have
    been evaluated. This allows plugins to be defined within these files
    as well.
2012-05-21 22:23:50 -07:00
Mitchell Hashimoto 3204b3a580 Vagrant.configure and versioned configuration
Vagrant.configure is now how configuration is done in Vagrantfiles
(previously it was Vagrant::Config.run). This function takes a single
argument which is the version of configuration to use.

Various internals were updated for this new versioned configuration.

Note that multiple versions of configuration aren't yet used so aren't
fully supported by Vagrant, but the foundation is being set here.
2012-05-21 21:47:01 -07:00
Mitchell Hashimoto 8c6f3edf2d Single-VM mode still allows target name in vagrant commands 2012-05-06 14:33:47 -07:00
Mitchell Hashimoto bc0643613a Vagrant.require_plugin [GH-916] 2012-05-06 14:01:10 -07:00
Mitchell Hashimoto 0d6248394c Tests for the Easy command base 2012-05-06 10:01:50 -07:00
Ryan LeCompte 2355a4b9a6 fix support for multiple unique easy commands 2012-05-06 01:47:43 -07:00
Mitchell Hashimoto 4cc3fb05df Passing unit tests 2012-05-05 22:32:19 -07:00
Mitchell Hashimoto 3d147f1d96 Raise exception if the insert_before middleware is not found 2012-05-05 22:10:26 -07:00
Mitchell Hashimoto 879f98b5d5 Action builder supports indexing middlewares by name 2012-05-05 22:01:53 -07:00
Mitchell Hashimoto c2649074c3 Test command name validation and fix up some bugs 2012-05-05 20:11:26 -07:00
Mitchell Hashimoto 00aba5ac03 Plugin easy commands.
Easy commands are well... easy! They don't offer the full power of
creating a completely custom command class, but they let you do the
basics (what almost everyone needs) with minimal fuss. Example:

class MyPlugin < Vagrant.plugin("1")
  name "my-plugin"

  easy_command "foo" do |action|
    puts "HELLO!"
  end
end

NOTE: The "action" stuff isn't done yet, but will be soon!
2012-05-05 18:57:29 -07:00
Mitchell Hashimoto 8850c086b1 Plugins can now have action_hooks 2012-05-05 18:28:07 -07:00
Mitchell Hashimoto 13a27eb723 More test cleanups 2012-05-01 22:10:10 -07:00
Mitchell Hashimoto 9b20173dfb Clean up some of the SSH key tests 2012-05-01 22:08:30 -07:00
Sean Wolfe 024f492cb3 Added spec to test the ssh key file permission changing. 2012-05-01 14:05:22 -07:00
Mitchell Hashimoto 30dd638e3c Remove legacy unit tests. 2012-04-19 21:45:17 -07:00
Mitchell Hashimoto 1489854d70 Move commands into plugins 2012-04-19 13:59:48 -07:00
Mitchell Hashimoto 661f20bb91 Move hosts to a plugin system 2012-04-18 22:20:45 -07:00
Mitchell Hashimoto 1cbac3167f Move provisioners into plugins 2012-04-18 21:53:19 -07:00
Mitchell Hashimoto 1b2fa748f9 Move all guests to plugins, even the distros 2012-04-18 21:23:25 -07:00
Mitchell Hashimoto 7766eb6098 Major guests have been moved to plugins 2012-04-18 21:03:03 -07:00
Mitchell Hashimoto dd459170dd Start moving guest configuration out into plugins 2012-04-18 17:38:20 -07:00
Mitchell Hashimoto a23fee4848 Remove old configuration classes 2012-04-18 17:16:03 -07:00
Mitchell Hashimoto b38fb5e974 Loader uses the new configuration classes 2012-04-18 17:03:34 -07:00
Mitchell Hashimoto c0ee3b06ff Config merging 2012-04-17 10:22:24 -07:00
Mitchell Hashimoto 92ee042fc2 V1 config loading using plugins as a source for config keys 2012-04-16 22:26:38 -07:00
Mitchell Hashimoto b46daa82bc Ability to define configuration classes on plugins 2012-04-15 16:04:54 -05:00
Mitchell Hashimoto 2eebc2cb68 Basic Plugin class 2012-04-15 15:34:44 -05:00
Mitchell Hashimoto d08a65e7f7 IsPortOpen utility 2012-03-23 10:26:29 -04:00
Mitchell Hashimoto a1b16fd96d Merge pull request #816 from Oakie3CR/chef-solo-encrypted-databags
Add encrypted data bag options to chef-solo
2012-03-23 06:21:36 -07:00
Mitchell Hashimoto 1b0a6a0895 Make unit tests pass from the safe_puts changes 2012-03-22 13:42:41 -07:00
Christian Rigdon b4e24c91f5 Add encrypted databag options to chef-solo 2012-03-13 16:27:11 -06:00
Mitchell Hashimoto f8fa859b5f Raise an error if the CWD is incorrect 2012-03-08 16:57:17 -08:00
Mitchell Hashimoto 6969f791ad VAGRANT_CWD can be set to set the CWD of `vagrant`. 2012-03-08 16:45:19 -08:00
Mitchell Hashimoto ce00a56ecb Even with a custom vagrantfile name, use defaults [GH-778] 2012-03-08 13:24:04 -08:00
Mitchell Hashimoto 7b9f64f577 Allow data store to work even if file path is nil 2012-02-25 10:41:06 -08:00
Mitchell Hashimoto 2c823e98bd Fix crashing bug with `primary_vm` on Environment 2012-02-24 10:27:34 -08:00
Mitchell Hashimoto ba42fffed0 Convert line endings to Unix-style [GH-727] 2012-02-10 18:07:59 -08:00
Bob Van Zant ae62c9bd68 Convert example host only IPs to RFC1918 2012-02-08 14:50:33 -08:00
Mitchell Hashimoto 3eff28ac0d Don't strip color codes with ANSI escape code remover 2012-02-05 13:30:21 +01:00
Mitchell Hashimoto 912e4974db Registry will now cache result values.
This is actually required so that we can do things like this
in plugins:

Vagrant.actions[:up].insert(Foo, Bar)
2012-01-28 17:31:50 -08:00
Mitchell Hashimoto d1e78f791d Remove test warnings, add ANSI escape code remover 2012-01-23 19:24:32 -08:00
Mitchell Hashimoto d487e286f4 Don't merge config keys that start with __.
This allows config classes to store internal state somehow.
2012-01-19 20:54:09 -08:00
Mitchell Hashimoto be97cec8b5 Allow shell expansions in shared folder guest paths again [GH-656] 2012-01-19 20:14:05 -08:00
Mitchell Hashimoto bdb591bc0f Tests that boolean configs are merged up properly [GH-651] 2012-01-18 18:51:15 -08:00
Mitchell Hashimoto 52a464a62c Push a failing acceptance test as a reminder of a missing feature 2012-01-13 00:07:23 -08:00
Mitchell Hashimoto 1380bc6ae7 Basic package acceptance tests 2012-01-12 23:52:25 -08:00
Mitchell Hashimoto 4cfabc690b Fix a failing unit test 2012-01-11 23:57:19 -08:00
Mitchell Hashimoto 7ddee76c00 Passing acceptance tests again 2012-01-11 23:21:07 -08:00
Mitchell Hashimoto f0b77d2f30 Additional fixes + tests for shell expansion [GH-633] 2012-01-11 22:56:15 -08:00
Mitchell Hashimoto 60b6d9ca9f Clarify comment on test 2012-01-11 22:16:00 -08:00
Mitchell Hashimoto 863ebe2d2f Custom merging for VM config 2012-01-11 22:12:49 -08:00
Mitchell Hashimoto 51353d51fc Test base merge 2012-01-11 21:31:19 -08:00
Mitchell Hashimoto bfb52ba7dc Top merges things in each key one by one by calling `merge` 2012-01-11 21:22:55 -08:00
Mitchell Hashimoto d13dd482b5 Some Config::Top class tests 2012-01-11 21:09:52 -08:00
Mitchell Hashimoto 008132b3cb Run each config proc only once 2012-01-11 20:59:21 -08:00
Mitchell Hashimoto 7c9c6e34ce Change caching behavior of config procs for the config loader 2012-01-11 16:58:40 -08:00
Mitchell Hashimoto 638881614a Test that multiple provisioners can be used 2012-01-10 22:04:31 -08:00
Mitchell Hashimoto bb2a473549 Added a `--provision-with` flag to specify provisioners to use. [GH-367] 2012-01-10 22:03:22 -08:00
Mitchell Hashimoto 566a751d6f Test that --no-provision works. 2012-01-10 21:29:26 -08:00
Mitchell Hashimoto f89479f3aa Basic host only network test 2012-01-10 21:25:36 -08:00
Mitchell Hashimoto 836468a51e Test the `:create` flag on shared folders 2012-01-10 21:20:24 -08:00
Mitchell Hashimoto 29ced979a2 Test for DNA json in Chef Solo 2012-01-10 21:14:16 -08:00
Mitchell Hashimoto 18cdcb4330 Acceptance tests for chef solo, fixed a bug it found. 2012-01-10 21:08:43 -08:00
Mitchell Hashimoto f264932430 Move network tests out into a module so other tests can use it 2012-01-10 20:47:26 -08:00
Mitchell Hashimoto 0c0d456db2 Add `--force` flag to `box add` [GH-631] 2012-01-10 20:37:33 -08:00
Mitchell Hashimoto 7eafb5fc1f Acceptance test that we can't add boxes with the same name 2012-01-10 18:45:38 -08:00
Mitchell Hashimoto d430d62941 Test overriding ports works properly 2012-01-08 23:29:40 -08:00
Mitchell Hashimoto 29eb419c86 Port forwarding tests pass again 2012-01-08 23:17:29 -08:00
Mitchell Hashimoto ef37f692bd Revert the check for duplicate Vagrantfiles.
This is just tricky with case sensitive/insensitive file systems.
Reverting since it doesn't seem worth it.
2012-01-08 23:15:18 -08:00
Mitchell Hashimoto 4f30a834d0 Tests for multivagrantfile being found 2012-01-08 23:04:23 -08:00
Mitchell Hashimoto 97f7fa633d Re-implement how networking is done internally 2012-01-02 19:51:38 -08:00
Mitchell Hashimoto 43fcca3dcb Retryable test 2011-12-26 17:38:47 -08:00
Mitchell Hashimoto 15a625275e HashWithIndifferentAccess test 2011-12-26 17:27:56 -08:00
Mitchell Hashimoto 91562e2111 FileChecksum test 2011-12-26 17:24:44 -08:00
Mitchell Hashimoto f65a6c3c6f `vagrant ssh -c` stderr now goes to stderr on the host as well 2011-12-26 10:03:12 -08:00
Mitchell Hashimoto e07280593d `vagrant ssh -c` will now exit with the same exit status of the command [GH-598] 2011-12-26 09:58:10 -08:00
Mitchell Hashimoto d80ff0a27f Pull out port collision detection/correction into the CheckPortCollision middleware 2011-12-25 10:13:08 -08:00
Mitchell Hashimoto 4e547becab Tests passing for GH-602 2011-12-25 09:57:20 -08:00
Mitchell Hashimoto fc9bda08cd Failing test for port collision on `resume` [GH-602] 2011-12-25 09:29:22 -08:00
Mitchell Hashimoto 919f7adaa3 Port collision with SSH test. 2011-12-24 22:25:02 -08:00
Mitchell Hashimoto 1f0720dfc2 Clean up the port forwarding test a bit 2011-12-24 21:40:08 -08:00
Mitchell Hashimoto f7275f5113 Test port forwarding basics 2011-12-24 17:59:10 -08:00
Mitchell Hashimoto 963bdff9fd Use Vagrant::Util::Subprocess for acceptance tests 2011-12-22 21:46:43 -08:00
Mitchell Hashimoto 40fdab3de8 DataStore tests and slight modifications 2011-12-22 21:18:59 -08:00
Mitchell Hashimoto e3426211bc Vagrant::Action::Warden unit tests 2011-12-22 20:41:01 -08:00
Mitchell Hashimoto 3cd262ed75 Unit tests for Vagrant::Action::Builder 2011-12-22 20:17:45 -08:00
Mitchell Hashimoto dfeafa3776 Fix halt issues and acceptance test associated with it 2011-12-22 13:38:30 -08:00
Mitchell Hashimoto 703f455d5a `vagrant version` is gone, so remove the acceptance test for it 2011-12-18 13:51:58 -08:00
Mitchell Hashimoto a8f5ed1863 Require vagrant environments for some commands. 2011-12-18 13:26:15 -08:00
Mitchell Hashimoto c2e3a3050a Ruby 1.8.7 compatibility 2011-12-17 20:22:46 -08:00
Mitchell Hashimoto e71007d47e `vagrant destroy` 2011-12-17 11:05:49 -08:00
Mitchell Hashimoto b292008f3b Change parse_options a bit to automatically add help and detect invalid options 2011-12-17 09:25:46 -08:00
Mitchell Hashimoto 43cadfe830 `vagrant up` 2011-12-17 09:14:05 -08:00
Mitchell Hashimoto 27491b554c Remove thor from requirements. Start revamping Vagrant::CLI 2011-12-16 23:34:30 -08:00
Mitchell Hashimoto eda286b476 Config classes are registered via a registry now 2011-12-15 20:32:33 -08:00
Mitchell Hashimoto b428072bb5 Provisioners use the registry. Cleaned up the way config classes are searched for. 2011-12-14 22:43:45 -08:00
Mitchell Hashimoto 2d0769ee4a Stub a test out for chef solo 2011-12-14 19:06:44 -08:00
Mitchell Hashimoto 9e4475cb77 Test running shell scripts inline 2011-12-14 19:02:10 -08:00