239 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
6d4f769c87 Validate provider 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
Chris Roberts
54502d5d66
Merge pull request #324 from hashicorp/fix-packaged-hang
Fix hanging commands when using packaged installation
2022-07-26 09:12:50 -07:00
Chris Roberts
b917dc466a Implement stop on the ruby internal service 2022-07-25 14:30:45 -07:00
Paul Hinze
fc76f71ffc
Fix vbox multimachine by setting provider parallel default correctly
Turns out I misinterpreted the behavior of a ruby method with a default
being passed nil so I assumed :parallel was effectively defaulting to
true when it is the opposite.
2022-07-25 15:52:11 -05:00
sophia
5bc7218a70 Load global ruby plugins 2022-07-13 14:08:46 -05:00
Chris Roberts
d5ec939022 Request target in spec and allow conversion to machine 2022-07-08 16:38:03 -07:00
Chris Roberts
f5d778d51a Revert "Merge pull request #300 from hashicorp/optimize-ruby-command-list"
This reverts commit 1c26a4abb0c9e095b3f6ec9944c4b15f6f1cd064, reversing
changes made to 186824a568583d8f6f2a50501d940ed71608fa0b.

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
Sophia Castellarin
0b53e06687
Merge pull request #297 from hashicorp/port-command-fix
Use remote provider
2022-07-07 12:21:48 -05:00
sophia
73801703e7 Pass machine to provider capabilities 2022-07-07 11:49:57 -05:00
Chris Roberts
1c26a4abb0
Merge pull request #300 from hashicorp/optimize-ruby-command-list
Optimize command list generation
2022-07-07 09:29:15 -07:00
Chris Roberts
6aa50189a2 Return empty results when no content to parse 2022-07-01 08:57:28 -07:00
sophia
20ec85b021 Use remote provider 2022-06-30 16:57:41 -05:00
Chris Roberts
067e6aeed1 Add get commands implementation to client and server 2022-06-29 16:13:36 -07:00
sophia
f4d3f38921 Fix type in communicator#ready funcspec 2022-06-29 17:23:42 -05:00
Chris Roberts
05baac1514 Update ruby config service to use wrapper protos 2022-06-24 18:27:38 -07:00
Chris Roberts
778d009bfb Mark configs with unique id. Use id for provisioner caching. 2022-06-22 12:33:07 -07:00
Chris Roberts
2890fb57c5 Finalize the entire Vagrantfile so all config is properly available 2022-06-20 16:04:01 -07:00
Chris Roberts
b8fbe1ace5 Remove some extraneous logging 2022-06-20 13:07:31 -07:00
Chris Roberts
17fc49cf41 Add provider parsing to internal endpoint 2022-06-20 13:05:26 -07:00
Chris Roberts
8061a95a81 Update internal service plugins and vagrantfile loading 2022-06-15 10:55:00 -07:00
Chris Roberts
41a47617b0 Add config service for handling configuration 2022-06-15 10:55:00 -07:00
Chris Roberts
582f253605 Update types used for provisioner service 2022-06-15 10:55:00 -07:00
Paul Hinze
71cc8ee7bb
Fix some bugs in provider options handling
- Defaultable needs to default to true when it's not specified
- We need to allow a non-defaultable provider to be selected if it shows
  up in the config
2022-06-08 17:25:16 -05:00
Paul Hinze
8b08b3117c
Use plugin options for Synced Folder priorities
Now that plugin options are available, we can use them to interpret
synced folder priorities and remove the shim we had in place.
2022-06-06 17:39:09 -05:00
Paul Hinze
8dbe72a5a0
Use Component Options to implement ProviderOptions
* Populates ComponentOptions into plugin structs
* Maps options for legacy Provider Plugins into PluginOptions
* Demos use of PluginOptions in a stub provider
* Honors plugin priority and defaultable settings
2022-06-03 16:37:05 -05:00
Paul Hinze
02a06bca45
Fixes for provider capability invocations
It looks like I might have been the first to hit provider cabability
invocation in testing these changes, and so I found these few missing
methods on the client. They're just copied over from the other
capability hosts.

Calling capabilities on a provider also revealed that the wrong Machine
type was being pulled out of the funcspec args, so we had to correct
that too in order to get the capability calls working.
2022-05-25 16:19:50 -05:00
sophia
2c0f43db3b Make flags that are only defined as --no- work 2022-05-23 11:41:08 -05:00
sophia
0b6781444a Resolve issue with Vagrant core providing more flag options than Vagrant legacy
This occurs when boolean flags in legacy Vagrant does
not define both a positive and negative boolean flag.
For example, --force and --no-force flags
2022-05-18 15:49:17 -05:00
sophia
28beec7bad Set alias for boolean flags that have a 'no-' option 2022-05-17 15:04:07 -05:00
sophia
6dfca17d54 Get machine state from go impl 2022-05-04 09:32:36 -05:00
sophia
333fc16096
Map provisioner config to Hash using mappers instead of assuming Struct type 2022-04-25 12:26:51 -05:00
Paul Hinze
7f56168959
Work around a few global flag collisions for ssh command
* `vagrant ssh` has a --no-tty flag colliding with the one defined in
   `bin/vagrant` - in fact none of the flags in `bin/vagrant` are
   processed in `serve` mode, so remove the code that captures them from
   the CommandInfo OptionParser dance
 * `vagrant ssh` has a `--plain` flag colliding with the one defined in
   `internal/cli/base.go` - this flag was inherited from Waypoint, so we
   can just rename it to line up with the (inversely defined) `--color`
   flag used in legacy vagrant
2022-04-25 12:26:48 -05:00
Paul Hinze
8f9952089a
Fix commands that run without a project
Some commands like `vagrant init` and `vagrant box` should be able to
run successfully without a full Project available in VAGRANT_CWD (in
other words, they don't require that a valid Vagrantfile be available.)

Thus far we've been assuming that a Project is available when
dispatching commands, which mean that commands of this nature weren't
working.

Here we make the Basis available to serve as an alternative client to
Vagrant::Environment::Remote such that it can be instantiated and passed
through to commands. This required some changes to Environment::Remote
to make its interactions with the client more defensive, but we manage
to avoid needing to make any changes to the normal legacy codepaths.
2022-04-25 12:26:47 -05:00
Chris Roberts
f457cbb72b
Use machine UI when processing actions 2022-04-25 12:26:43 -05:00
Chris Roberts
20d717a521
Update provisioner service plugin setup and caching 2022-04-25 12:26:39 -05:00
Chris Roberts
39a85d1cf3
Support caching plugins within services 2022-04-25 12:26:39 -05:00
Chris Roberts
2b5bd64ec8
Remove local provider injection to machine 2022-04-25 12:26:39 -05:00
Chris Roberts
f88254eb23
Let #with_plugin load plugins by type 2022-04-25 12:26:38 -05:00
Chris Roberts
f183a8a810
Update provisioner service implementation 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
2b38005dfb
Include namespace for wrapper type 2022-04-25 12:26:37 -05:00
sophia
94698704ab
Fix some small errors 2022-04-25 12:26:37 -05:00
Chris Roberts
14d2d66d29
Use folders and options types in client/services 2022-04-25 12:26:36 -05:00
Chris Roberts
b7f074e492
Remove debugging artifacts 2022-04-25 12:26:36 -05:00
Chris Roberts
095a0f8847
WIP checkpoint with callable remote provider action 2022-04-25 12:26:35 -05:00
sophia
55fb52f174
Update the synced folder client to pass direct values 2022-04-25 12:26:34 -05:00