142 Commits

Author SHA1 Message Date
Kalman Hazins
bb052366f7 Change symbols inside hashes to 1.9 JSON-like syntax 2014-05-22 12:35:12 -04:00
Alex Rodionov
34ec385c81 core: public_send vs send when merging configs
This fixes the problem when config keys collide with Kernel/Object
methods (private). An example is `exec` which is used in vagrant-exec
plugin.

Compare:

> old.send :exec
ArgumentError: wrong number of arguments (0 for 1+)
> old.public_send :exec
=> #<Vagrant::Config::V2::DummyConfig:0x007fe212cc05c8>
2014-05-07 19:02:21 +07:00
Mitchell Hashimoto
92df8cf6ae Handle a lot of TODOs 2014-04-29 16:50:58 -07:00
Mitchell Hashimoto
4df8636c38 core: instantiate all keys in a V2 config prior to merging
This forces everything to get a new instance, so we don't accidentally
overwrite any values across multiple machines.
2014-04-21 13:55:30 -07:00
Mitchell Hashimoto
f72db0c611 core: config raises NoMethodError on bad calls once finalized 2014-02-05 16:14:58 -08:00
phinze
ee44e717f0 core: fix small comment typo 2013-11-27 18:56:48 -06:00
Mitchell Hashimoto
7ef6c5d9d7 Unused config objects are finalized properly [GH-1877] 2013-07-23 17:36:48 -05:00
Mitchell Hashimoto
98a23be689 Get rid of unused class 2013-04-10 10:48:56 -07:00
Mitchell Hashimoto
7547a0d34a V2 missing key returns a DummyConfig as well 2013-02-28 00:17:58 -08:00
Mitchell Hashimoto
af2690635e Unknown keys return a DummyConfig rather than OpenStruct 2013-02-28 00:16:43 -08:00
Mitchell Hashimoto
d15acde8c0 Capture missing key calls in V1 configs and record them as warnings 2013-02-28 00:06:49 -08:00
Mitchell Hashimoto
595d6f7848 Record invalid key accesses as an error on config 2013-02-08 16:54:24 -08:00
Mitchell Hashimoto
87026b2d9e Remove old TOOD that was fulfilled 2013-02-05 22:17:00 -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
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
2d57afbbda Support warnings/errors when upgrading Vagrantfiles internally 2013-01-20 22:04:50 -05:00
Mitchell Hashimoto
37e36010e0 Remove the ErrorRecorder 2013-01-18 13:15:22 -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
e0c8fadae4 I can remove the validate! method from the v1 root 2013-01-18 12:18:30 -08:00
Mitchell Hashimoto
e6f9586d83 New validation method on the root that returns errors 2013-01-18 12:14:40 -08:00
Mitchell Hashimoto
2da812bd48 Change log levels of some messages that are useful 2012-12-23 16:29:24 -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
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
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
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
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
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
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
51be92eeb6 Remove dependence on V1 Kernel from Environment 2012-06-14 18:46:48 -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
95e554314e Foundation for supporting multiple version types
I created VersionBase which is the abstract base class for any
configuration versions. Configuration versions are responsible for
knowing how to load configuration given a proc (from a
Vagrant.configure block), as well as merging configuration procs. In the
future, it will have to upgrade versions as well. This is not done yet.

The VERSIONS constant was added to Vagrant::Config which is a registry
to keep track of all the available configuration versions. The
VERSIONS_ORDER constant is an array of the ordering of these versions.
The ordering is important so that in the future Vagrant can attempt to
gracefully upgrade the configurations. It is also used to determine the
current configuration version (which is assumed to be the last version
in the order).

The loader was modified to use the current version and the VERSIONS
registry instead of hardcoding V1.
2012-05-20 17:47:24 -07:00
Mitchell Hashimoto
a23fee4848 Remove old configuration classes 2012-04-18 17:16:03 -07:00
Mitchell Hashimoto
a62e859231 Get rid of the UNSET_VALUE stuff, save it for v2 2012-04-18 17:09:25 -07:00
Mitchell Hashimoto
b38fb5e974 Loader uses the new configuration classes 2012-04-18 17:03:34 -07:00
Mitchell Hashimoto
98d6bf958e Move core config into a plugin 2012-04-17 22:12:27 -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
cd92d6483f Update CHANGELOG 2012-03-15 09:52:28 -06:00
Remco Vermeulen
728dbe5a4f Make sure that the private_key_path is expanded before checking existence.
This allows for paths like ~/.ssh/some_key to be defined in the Vagrantfile.
2012-03-14 12:02:31 +01:00