59 Commits

Author SHA1 Message Date
Chris Roberts
e958c6183a Adds initial HCP config support
Adds initial basic support for HCP based configuration in vagrant-go.
The initalization process has been updated to remove Vagrantfile parsing
from the client, moving it to the runner using init jobs for the basis
and the project (if there is one). Detection is done on the file based
on extension for Ruby based parsing or HCP based parsing.

Current HCP parsing is extremely simple and currently just a base to
build off. Config components will be able to implement an `Init`
function to handle receiving configuration data from a non-native source
file. This will be extended to include a default approach for injecting
defined data in the future.

Some cleanup was done in the state around validations. Some logging
adjustments were applied on the Ruby side for better behavior
consistency.

VirtualBox provider now caches locale detection to prevent multiple
checks every time the driver is initialized.
2023-09-07 17:26:10 -07:00
hashicorp-copywrite[bot]
36a312ee26
add missing license headers and update copyright file headers to BUS-1.1 2023-08-10 21:53:25 +01:00
sophia
c2d8f892ac Find type to unany objects when mapping
find_types works fine until you have a module which has the same name but different case. For example, the VagrantVmware package is HashiCorp::VagrantVMwareDesktop. All the protos are at Hashicorp::Vagrant::… So, you end up with this fun

Object.constants.select { |n| n.to_s.downcase == "hashicorp" }
=> [:HashiCorp, :Hashicorp]

So, when trying to walk down the modules to find the right type to unany to, Vagrant sometimes takes the wrong path (eg. Down the HashiCorp module instead of the Hashicorp module).

This change will keep a list of the parent modules when walking down the module list. This way if a dead end is reached then Vagrant can go a level back and keep searching for the correct class.
2022-07-26 12:22:28 -05:00
Chris Roberts
0d562673f9 Just print class information in error content 2022-06-24 18:27:00 -07:00
Chris Roberts
f949eb9042 Load new mappers and allow for direct conversion 2022-06-15 10:55:00 -07:00
Chris Roberts
f3a3bb83fd
Only register types for blind maps after a blind map 2022-04-25 12:26:55 -05:00
Chris Roberts
e8a4c35cf6
Remove any unpacking of value prior to mapping 2022-04-25 12:26:55 -05:00
Chris Roberts
2baea78820
Properly clone mappers 2022-04-25 12:26:55 -05:00
Chris Roberts
823e589a26
Freeze base mappers list to prevent direct modifications 2022-04-25 12:26:55 -05:00
Chris Roberts
2f9daa8498
Include value in error message when mappers not found 2022-04-25 12:26:55 -05:00
Chris Roberts
61b5d3549f
Don't use blind mapping when generating value 2022-04-25 12:26:54 -05:00
Chris Roberts
3917449552
Provide source information when mapping, register blind maps 2022-04-25 12:26:54 -05:00
Chris Roberts
f6a46634a5
When performing a blind map, if previous mapping found, use it 2022-04-25 12:26:54 -05:00
Chris Roberts
1d555b025f
Use global list of mappers and cache as defaults 2022-04-25 12:26:54 -05:00
Chris Roberts
7404ef89a6
Isolate generate class from instance so we can do class checks 2022-04-25 12:26:54 -05:00
Chris Roberts
3a6308b7fc
Use blocks for logging content to reduce processing 2022-04-25 12:26:54 -05:00
sophia
9a61574f52
Add core plugin manager to default mapper list 2022-04-25 12:26:50 -05:00
sophia
b40dde3797
Module for core plugin manager mappers 2022-04-25 12:26:50 -05:00
Chris Roberts
8542650e38
If destination is any, only allow proto destinations 2022-04-25 12:26:38 -05:00
Chris Roberts
83ca40e239
Refactor Ruby service implementations
Update the Ruby service implementations to use the funcspec util
    module for generating spec content. A helper method is now used
    for generating a parent class for services to subclass which
    automatically includes all required modules for usage.
2022-04-25 12:26:37 -05:00
Paul Hinze
ff86d86ac8
Provisioner Plugins 2022-04-25 12:26:37 -05:00
Chris Roberts
c7fdd92eb5
Add folders type to mappers 2022-04-25 12:26:36 -05:00
Chris Roberts
b7f074e492
Remove debugging artifacts 2022-04-25 12:26:36 -05:00
Chris Roberts
9a6f5fa316
Don't unany mapping if source value is proto 2022-04-25 12:26:35 -05:00
Chris Roberts
095a0f8847
WIP checkpoint with callable remote provider action 2022-04-25 12:26:35 -05:00
Chris Roberts
e7686882fa
Log error and stacktrace on mapping errors 2022-04-25 12:26:31 -05:00
Chris Roberts
32ea6a4509
Add new options type with mappers 2022-04-25 12:26:31 -05:00
Chris Roberts
a98d91e15f
Unpack named arguments and provide value to flag generation request 2022-04-25 12:26:30 -05:00
Chris Roberts
32251ecb64
Include named value to mapper graph 2022-04-25 12:26:28 -05:00
Chris Roberts
1f731bbf9f
Add more default type maps 2022-04-25 12:26:28 -05:00
Chris Roberts
7c69fde71c
Break out type finding from unany method 2022-04-25 12:26:28 -05:00
sophia
1e428a0812
Add mappers for provider 2022-04-25 12:26:24 -05:00
Paul Hinze
0fef7cc416
Port push plugins
This uses the new Push plugin support added to the plugin SDK in https://github.com/hashicorp/vagrant-plugin-sdk/pull/106 to make the following changes:

 * The plugin manager on the Go side now registers push plugins
 * The the _remote_ plugin manager on the Ruby side now calls over to
   the go side to get push plugins
 * All the wiring is hooked up such that when a push plugin is replaced
   with its remote GRPC-client-wielding equivalent, the messages are
   ferried around.
2022-04-25 12:26:21 -05:00
Chris Roberts
914530d26a
Use trace log level for noisy log messages 2022-04-25 12:26:19 -05:00
Chris Roberts
43e5550203
Store the destination type so we can see it in the logs 2022-04-25 12:26:18 -05:00
Chris Roberts
2ff7d6a5bd
Allow value to be mapped to be nil 2022-04-25 12:26:18 -05:00
Chris Roberts
033dfba056
Fix known arguments value usage and do not allow adding nil values 2022-04-25 12:26:17 -05:00
Chris Roberts
9ace68f424
Add known mapping for synced folders 2022-04-25 12:26:17 -05:00
Chris Roberts
1e3547fdaa
Update log output and return immediately if type 2022-04-25 12:26:17 -05:00
Chris Roberts
6bdc7baf39
Update name from Types to Type 2022-04-25 12:26:16 -05:00
Chris Roberts
c6feb89138
Remove mappers that output the same type as the input 2022-04-25 12:26:16 -05:00
Chris Roberts
de18081a35
Add mappers for host and plugin manager clients 2022-04-25 12:26:15 -05:00
sophia
a3c3bb9cf1
Add mappers for synced folder client -> vagrant synced folder 2022-04-25 12:26:13 -05:00
sophia
ce6b2c8338
Add mapper for communicator command 2022-04-25 12:26:08 -05:00
Chris Roberts
fbde80af43
Add default mapping for named capabilities 2022-04-25 12:26:05 -05:00
sophia
841573194e
Add mappers for synced folders and basis 2022-04-25 12:26:05 -05:00
Chris Roberts
c7d13e62c7
Ensure output of mapper to unpack funcspec is a proto 2022-04-25 12:26:02 -05:00
Chris Roberts
6a1c5f1c7f
Add default map list for blind mappings. Unpack funcspec before map. 2022-04-25 12:26:02 -05:00
Chris Roberts
100ad1330d
Remove automatic caching and add short circuits 2022-04-25 12:26:01 -05:00
Chris Roberts
3aa4e1bab4
Add mapping for pathnames 2022-04-25 12:26:00 -05:00