Commit graph

433 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
Chris Roberts
02f844a05d Require project path to not be empty on test setup 2023-06-12 09:33:00 -07:00
Chris Roberts
0c21086bc2 Test cleanups and adjustments to get everything working 2023-06-07 17:46:04 -07:00
Chris Roberts
6d88f3a54f Fix up some of the testing 2023-06-05 14:18:53 -07:00
Chris Roberts
f9b3d67f6c Set target source when cloning 2023-06-05 14:18:06 -07:00
Chris Roberts
5445c2195e Include project when looking up target 2023-06-05 14:18:06 -07:00
Chris Roberts
2cf64d733b Fix doc string, only uuid is checked 2023-06-05 14:18:06 -07:00
Chris Roberts
b6192eba0d Fixup scoping usage to properly validate 2023-06-05 14:18:05 -07:00
sophia
f811e995da Return errors when box metadata is unavailable or invalid 2022-09-28 16:52:00 -04:00
sophia
3be4eacaa9 Return an error if the provider is not usable 2022-09-20 14:33:43 -04:00
sophia
49280286ad Strip new lines from error details
The error details message should just be one string without spacing
so the terminal can set a output length. This will allow messages
from Ruby and Go errors to have similar formating.
2022-09-19 15:14:42 -04:00
sophia
b9fb6c5f5f Refactor to use localizer to create error with status 2022-09-19 15:14:42 -04:00
sophia
bd801af984 Add details to errors 2022-09-19 15:14:42 -04:00
sophia
9a276d7818 Get additional message into error 2022-09-19 15:14:42 -04:00
sophia
ccb89c0143 Don't check for errors when checking if a provider is usable
If a provider is unusable then Usable() will throw an error. When
checking for a default provider, Vagrant should not raise an error
if there is an issue with executing Usable().
2022-09-19 15:14:42 -04:00
sophia
6d4f769c87 Validate provider 2022-09-19 15:14:42 -04:00
sophia
f26ff28ad4 Set provider if available 2022-09-19 15:14:42 -04:00
Paul Hinze
7c56c74bb6
Support and honor the "primary" option for Command plugins 2022-07-27 11:36:04 -05:00
sophia
7441927f06 Set not created machine state when appropriate 2022-07-25 15:16:40 -05:00
sophia
5df47c8856 Check for existence of metatdata.json to determine if a box is v1 2022-07-25 13:05:48 -05:00
sophia
7678c28f65 Add warning about v1 boxes 2022-07-25 12:29:59 -05:00
sophia
0af2ff5709 Automatically update v1 boxes 2022-07-25 12:29:32 -05:00
Paul Hinze
da77316f9a
Fix virtualbox lifecycle acctests
Two fixes:

 1. Allow us to make it through Vagrant::Environment initialization when
    there's no project yet, fixing box add and init commands.
 2. Don't prune UNKNOWN targets from state... as VBox looks like it
    leaves things in that state when it runs suspend.
2022-07-13 18:36:11 -05:00
Chris Roberts
58fce40886 Add AsTarget() to machine and include nicer output 2022-07-11 15:08:08 -07:00
Chris Roberts
766b951040 Ensure config is set on basis/project during init 2022-07-08 16:38:03 -07:00
Chris Roberts
df42e88aab Attach project logger to target on scrub 2022-07-08 16:38:03 -07:00
Chris Roberts
23983d30d4 Reload project after target created in tests 2022-07-08 16:38:03 -07:00
Chris Roberts
410650117d Setup our logger so we get output on failures 2022-07-08 16:38:03 -07:00
Chris Roberts
6d0b5363c1 Update target init/scrub behavior on projects 2022-07-08 16:38:03 -07:00
Chris Roberts
7c28aa3ce8 Add Exists() helper to target 2022-07-08 16:38:02 -07:00
Chris Roberts
e78d0b6681 Close project in test to force full target removal 2022-07-08 16:38:02 -07:00
Chris Roberts
08bcc8e9c7 When unsetting machine ID, just set state to not created 2022-07-08 16:38:02 -07:00
Chris Roberts
df0a4342a6 When project is provided set ref into data 2022-07-08 16:38:02 -07:00
Chris Roberts
2c756b3c07 Update testing helpers to use factory 2022-07-08 16:38:02 -07:00
Chris Roberts
2c35229013 Perform target lookup to validate exist and name 2022-07-08 16:38:02 -07:00
Chris Roberts
9fe9492875 Only store configuration if vagrantfile defined 2022-07-08 16:38:02 -07:00
Chris Roberts
bdf1cfe6bf Set test target state to created 2022-07-08 16:38:02 -07:00
Chris Roberts
762fac3ae6 Init project config and only save if vagrantfile defined 2022-07-08 16:38:02 -07:00
Chris Roberts
0a4b9c9019 Always save the target when saving machine 2022-07-08 16:38:02 -07:00
Chris Roberts
5619341880 Use factory values only if provided options left unset 2022-07-08 16:38:02 -07:00
Chris Roberts
a3b32bdf60 Default configuration data, only store if vagrantfile defined 2022-07-08 16:38:02 -07:00
Chris Roberts
0f7c4f25c1 Load target in index via factory. Filter targets. 2022-07-08 16:38:02 -07:00
Chris Roberts
51d8c84740 Refactor how scopes are created and initialized 2022-07-08 16:38:02 -07:00
Chris Roberts
b82d55cc37 Update vagrantfile to load machines via factory 2022-07-08 16:38:02 -07:00
Chris Roberts
81754f4f9a Add logging when using cache version and closing instance 2022-07-08 16:38:02 -07:00
Chris Roberts
50dd39c5f4 Update factory to build scope types 2022-07-08 16:38:02 -07:00
Paul Hinze
ee8883153c
Make Docker provider work again post config refactor
- Allow machine.box to be empty without sadness (depends on
   https://github.com/hashicorp/vagrant-plugin-sdk/pull/182)
 - Get synced folder type from plugin name instead of defaulting to
   :virtualbox
2022-07-08 11:36:27 -05:00
Sophia Castellarin
66a22e5254
Merge pull request #303 from hashicorp/synced_folder_has_override_opts
Synced folder has override opts
2022-07-07 16:28:14 -05:00
Chris Roberts
f5d778d51a Revert "Merge pull request #300 from hashicorp/optimize-ruby-command-list"
This reverts commit 1c26a4abb0, reversing
changes made to 186824a568.

The changes broke plugin loading when using subcommands so these
changes will be reverted until the underlying issue can be
investigated and resolved.
2022-07-07 14:03:56 -07:00