5276 Commits

Author SHA1 Message Date
sophia
d5aacc0bc6
Thrash around making to proto for config faster 2022-04-25 12:26:51 -05:00
sophia
f4811af759
Use symbol proto when protoizing plugin configs 2022-04-25 12:26:51 -05:00
sophia
ccf2bf6197
Pass config as a SDK hash in order to use the Symbol proto 2022-04-25 12:26:51 -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
sophia
afc6d1c27d
Extract core plugin manager from context 2022-04-25 12:26:50 -05:00
sophia
05244e67c1
Add mappers for core plugin manager 2022-04-25 12:26:50 -05:00
sophia
b3003e8cb6
Add core plugin service client 2022-04-25 12:26:50 -05:00
Paul Hinze
1341bfe0af
Tweak Ruby->Go error handling so exit codes match
In legacy Vagrant, any exception raised that's a subclass of
Vagrant::Errors::VagrantError is considered user-facing and so causes
the error message to be printed to the console and the process to use
exit code 1. Anything outside of that causes the process to use exit
code 255. (See `bin/vagrant` for the code.)

Here we mirror that behavior by treating errors that have a
LocalizedMessage as user-facing and those without as unexpected. This
allows the basic virtualbox component to pass in vagrant-spec!
2022-04-25 12:26:49 -05:00
Paul Hinze
09c03893b2
Simplify truncate_to per feedback
No need to spin up a full regexp if it's not necessary!
2022-04-25 12:26:49 -05:00
Paul Hinze
253c6658b3
Truncate error message to address RST_STREAM issues
This is the result of a whole journey of learning about GRPC errors! See
the hefty inline comment which has all the context for future
generations.
2022-04-25 12:26:49 -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
sophia
128599ab68
Get local box metadata in remote box 2022-04-25 12:26:47 -05:00
sophia
b6d42d0695
Clean up machine client 2022-04-25 12:26:46 -05:00
sophia
f55da8168a
Check if a box is in use using the machines endpoint
This returns a list of machine index entries that use the box. This
is what is expected from the Ruby side.
2022-04-25 12:26:46 -05:00
sophia
4dcd120448
Load machine from machine ref 2022-04-25 12:26:46 -05:00
sophia
8b5bc0cd1c
Set box metadata url 2022-04-25 12:26:45 -05:00
sophia
3516aa7131
Set defailt Vagrant log level 2022-04-25 12:26:44 -05:00
Paul Hinze
7c1d2e5368
Use optional fields on Synced Folder instead of empty string checks
Addresses concerns raised in discussion here
https://github.com/hashicorp/vagrant-ruby/pull/219#discussion_r816966056
and makes it so we don't have to change any plugin code to make things
work.

Depends on https://github.com/hashicorp/vagrant-plugin-sdk/pull/133
2022-04-25 12:26:44 -05:00
Paul Hinze
0fc068822a
Fix rsync ownership settings in synced folders
When the opts are being pass through the go side, we get back empty
string values instead of nil values, so the `||=` assignment was not
working to populate the default owner and group. This was causing the
rsync_post hook to fail on linux guests.
2022-04-25 12:26:43 -05:00
Chris Roberts
f457cbb72b
Use machine UI when processing actions 2022-04-25 12:26:43 -05:00
Chris Roberts
df0bbe343f
Support bold style and add #clear_line 2022-04-25 12:26:43 -05:00
Chris Roberts
71fb214d95
Add #input to terminal client and use event stream 2022-04-25 12:26:43 -05:00
Paul Hinze
06ad1b4565
Fixup tests for Ruby 3.0
This is a pass through test failures and deprecation warnings:

 * Make all ambiguous `.with(..., key: val)` use explicit hashes to
   prevent test failures for argument mismatch in Ruby 3.0
 * Scope down all unbounded `raise_error` to address warnings (remove
   one test that was revealed to be referencing a nonexistent variable
   once the raise_error was scoped.)
 * Update all `any_instance` usage to new syntax to address warnings
 * Allow the service cache to be cleared and do so between some tests
 * Fix a small bug in with_plugin's plugin not found code path (revealed
   by a scoped and_raise)
2022-04-25 12:26:40 -05:00
Chris Roberts
20d717a521
Update provisioner service plugin setup and caching 2022-04-25 12:26:39 -05:00
Chris Roberts
74ff5da434
Trace item registration in the cache 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
ab8dee7a72
Add some missing mappers for converting to proto 2022-04-25 12:26:39 -05:00
Chris Roberts
6dd5a3ae9b
Load plugins within #with_plugin helper 2022-04-25 12:26:39 -05:00
Chris Roberts
d070b2cc6f
Initialize cache in the proper location within Service class 2022-04-25 12:26:38 -05:00
Chris Roberts
b0b5d1191e
Update and document cacher 2022-04-25 12:26:38 -05:00
Chris Roberts
f88254eb23
Let #with_plugin load plugins by type 2022-04-25 12:26:38 -05:00
sophia
b7d12a0907
Get provider from remote machine 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
2f4670e48a
Define cache for services and provide it 2022-04-25 12:26:38 -05:00
Chris Roberts
8542650e38
If destination is any, only allow proto destinations 2022-04-25 12:26:38 -05:00
Chris Roberts
3e7f72b9b0
Extract direct arguments to use for spec 2022-04-25 12:26:37 -05:00
Chris Roberts
987998aa41
Grab cacher from local instance 2022-04-25 12:26:37 -05:00
Chris Roberts
b976be72bd
Simplify cacher 2022-04-25 12:26:37 -05:00
Chris Roberts
d82702064f
Only deactivate remote plugin manager if activated 2022-04-25 12:26:37 -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
Chris Roberts
4679d39039
Fix name and method call in folders mappers 2022-04-25 12:26:37 -05:00
sophia
94698704ab
Fix some small errors 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
14d2d66d29
Use folders and options types in client/services 2022-04-25 12:26:36 -05:00
Chris Roberts
c32ba38b70
Add mappers for Folders type 2022-04-25 12:26:36 -05:00