37 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
a6caa47f8e Environment#active_machines should return a list of tuple
The tuple should be compsed of the machine name (as a string)
and provider name (as a symbol)
2022-07-08 11:41:18 -05:00
Paul Hinze
fb2a102c71
Fix init and other commands that run without a project
The Basis needs to be able to respond to Vagrantfile() and
DefaultProvider() to make it through Vagrant::Environment
initialization.

Depends on https://github.com/hashicorp/vagrant-plugin-sdk/pull/178
2022-07-01 11:56:08 -05:00
Chris Roberts
09e6ff7ba2 Use client to get vagrantfile for environment 2022-06-15 11:06:33 -07:00
Paul Hinze
e605132321
Pass along provider to environment.target
Mirrors change in https://github.com/hashicorp/vagrant-plugin-sdk/pull/157
2022-05-25 16:19:50 -05:00
Paul Hinze
06350a7afc
Port default provider selection
- Pulls in the SDK changes to Project.DefaultProvider and Project.Target
- Implements the hefty default provider method
- Un-hard-codes provider from Target, and sets it when a Target is
  looked up from a Project
2022-05-25 16:19:50 -05:00
Paul Hinze
8ff4fd674c
Add back in some respond_to checks
Helps Environment::Remote to work when it's handed a Basis client for
operations like `box list` and `vagrant init`.
2022-05-06 15:23:54 -05:00
sophia
e020c6600e Hacks to let a remote machine be instantiated with or with out a client 2022-05-04 11:25:54 -05:00
sophia
6c10944c52 Clean up unused functions 2022-05-04 11:23:12 -05:00
sophia
053d658e52 Get default provider from go side
For now the go side will just return a hard coded value for the
default provider. It should be implementing the algorithm defined
at https://www.vagrantup.com/docs/providers/basic_usage.html#default-provider
2022-05-04 11:23:12 -05:00
sophia
0117c01e4b Fill in environment remote class 2022-05-04 11:22:41 -05:00
Paul Hinze
e5a75b78ec
Update Environment::Remote to match Environment changes
Since the `initialize` method is copied over, we need to mirror changes
from #250 into that copy
2022-04-25 12:26:55 -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
sophia
2469016be1
Use remote machine/environment 2022-04-25 12:26:22 -05:00
sophia
45cfcc4c34
Return empty response if capability returns an empty response 2022-04-25 12:26:04 -05:00
sophia
f71aa68a69
Get box collection from vagrant-go 2022-04-25 12:25:56 -05:00
sophia
54c0b0528d
Add remote host module 2022-04-25 12:24:39 -05:00
sophia
9599024fa5
Don't setup paths for remote environment 2022-04-25 12:24:37 -05:00
sophia
5d46b93a99
Each component client stores their proto 2022-04-25 12:24:37 -05:00
sophia
b8468644f3
Load vagrantfile given by remote project 2022-04-25 12:24:36 -05:00
sophia
ca3d76ca7d
Use project client to populate environment options 2022-04-25 12:24:36 -05:00
sophia
5ca687cad4
Implement project home path, cwd and default private key 2022-04-25 12:24:36 -05:00
Chris Roberts
8f4bb571a5
Update remote function name and setup 2022-04-25 12:24:30 -05:00
sophia
10a1f1011b
Get datadir for machine and project 2022-04-25 12:24:29 -05:00
sophia
68aa184bee
Get local data path from project 2022-04-25 12:24:28 -05:00
sophia
f761af3c55
Move client creation into client module 2022-04-25 12:24:28 -05:00
sophia
c71eb9ea0e
UQuery machine index by uuid 2022-04-25 12:24:28 -05:00
sophia
8808ef353e
Clean up logging 2022-04-25 12:24:27 -05:00
sophia
1ea5b2ba91
Save point: use target ref to retrieve info from target index 2022-04-25 12:24:26 -05:00
sophia
7de0fe1bd8
Get machine index remote service setup 2022-04-25 12:24:26 -05:00
sophia
c123335456
Save point: connect to machine index service 2022-04-25 12:24:26 -05:00
Chris Roberts
fe293dfd1f
Require client to be set and provide stub on initial startup
When running in server mode, make the Environment validate a client
option is provided on instantiation. If no client option is provided,
raise an exception since it is required in server mode.

Since an initial Environment is required during start, include a
stub value for the client so the initial Environment can be instantiated
successfully and the GRPC service can be started.
2022-04-25 12:24:23 -05:00
sophia
e86dc5958a
Clean up debugging cruft 2022-04-25 12:24:09 -05:00
sophia
fc8fe0a106
Make status work 2022-04-25 12:24:09 -05:00
sophia
340c2d7b19
Save point: load target from project 2022-04-25 12:24:09 -05:00
Chris Roberts
6994f5d5a7
Start adding updates for remote environment in ruby runtime 2022-04-25 12:24:08 -05:00