5166 Commits

Author SHA1 Message Date
sophia
93ec8c1571
Refactor with_plugins util 2022-04-25 12:26:24 -05:00
sophia
81a9d7b241
Pass machine to provider functions 2022-04-25 12:26:24 -05:00
sophia
fcf405bdf8
Run provider actions 2022-04-25 12:26:24 -05:00
sophia
274ed6c756
Add mapper for machine state 2022-04-25 12:26:24 -05:00
sophia
8355209654
Accept machine for provider state endpoint 2022-04-25 12:26:24 -05:00
sophia
1e428a0812
Add mappers for provider 2022-04-25 12:26:24 -05:00
sophia
f3a1a9caa6
Add dependency on common protos for error details 2022-04-25 12:26:24 -05:00
sophia
526b7f2318
Remote init from provider grpc api 2022-04-25 12:26:23 -05:00
sophia
c48e43a12a
Add provider ruby client 2022-04-25 12:26:23 -05:00
sophia
75e6081e6d
Fill in provider ruby service 2022-04-25 12:26:23 -05:00
Paul Hinze
a86965c340
ruby mappers: Unwrap wrapper types in Hashes and Arrays
Boolean types (and possibly a few others) are returned as wrapper
classes when coming out from proto mapping; these need to be unwrapped
otherwise the caller who is expecting a nice clean boolean value ends up
with an icky protobuf class.

This fixes the shell provisioner, which relies on a communicator
receiving a settings hash `{error_check: false}` for a command that
usually fails but it sent just in case before provisioning starts.
2022-04-25 12:26:23 -05:00
sophia
c01a38b6e1
Load target index targets 2022-04-25 12:26:22 -05:00
Chris Roberts
1a32e8c2f9
Fetch command banner and remove switch characters 2022-04-25 12:26:21 -05:00
Chris Roberts
5e6fe71a37
Use ruby command arguments type when executing command 2022-04-25 12:26:21 -05:00
Chris Roberts
7b82ba7ca0
Add ruby local command arguments type and mapper 2022-04-25 12:26:21 -05:00
Paul Hinze
92c345b42d
Allow go push plugins to use config from Vagrantfile
* Populate push configs when parsing the vagrantfile
* Allow untyped configs to be shipped over GRPC
* In our demo plugin, walk the vagrantfile and snag the config

Example Vagrantfile that works with the demo plugin:

```ruby
Vagrant.configure("2") do |config|
  config.push.define "myplugin" do |push|
    push.coolkey = "coolvalue"
    push.alist = ["so", "many", "items"]
    push.ahash = { "hashkey" => "hashvalue" }
  end
end

```
2022-04-25 12:26:21 -05:00
Paul Hinze
737c1a5f8b
Use the simpler plugin interface for Push plugins
* Bumps the go.mod to the just-merged SDK version
* Returns empty results on success vs messing around with PushResponses
2022-04-25 12:26:21 -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
sophia
53f7b3f8eb
Update tests for GRPC errors 2022-04-25 12:26:20 -05:00
sophia
deb667ecd3
Use common rpc errdetails messages 2022-04-25 12:26:20 -05:00
sophia
df5f7d40e8
Rename exception logger to exception transformer
The exception logger no longer logs errors. Instead it transforms
the errors into a grpc friendly format. The exception that would
have been logged at this point gets logged when the task completes.
2022-04-25 12:26:20 -05:00
sophia
a62c3d69cf
Only wrap error in grpc error if not already 2022-04-25 12:26:20 -05:00
sophia
c4e97bb89b
Send localized message originating from plugin (if applicable) 2022-04-25 12:26:20 -05:00
sophia
d09c12dad3
Add status proto message to outgoing errors 2022-04-25 12:26:20 -05:00
sophia
c70da0f548
Raise Vagrant error 2022-04-25 12:26:20 -05:00
sophia
0dcefddae4
Only add exception logger to non-generic methods 2022-04-25 12:26:20 -05:00
sophia
441f82760b
Include exception logger and attach to all available methods 2022-04-25 12:26:19 -05:00
Chris Roberts
914530d26a
Use trace log level for noisy log messages 2022-04-25 12:26:19 -05:00
Chris Roberts
dc03dd9cad
Wrap remote manager setup/teardown within usage tracker 2022-04-25 12:26:19 -05:00
Chris Roberts
d5cf2b66ed
Define a manager tracker for enabling remote manager 2022-04-25 12:26:18 -05:00
Chris Roberts
1a80e6112b
Remove WithMapper module and add autoload for UsageTracker 2022-04-25 12:26:18 -05:00
Chris Roberts
1849e941f3
Add helper class for usage tracking 2022-04-25 12:26:18 -05:00
Chris Roberts
b08ca1e109
Convert to pathnames on upload and download 2022-04-25 12:26:18 -05:00
Chris Roberts
2bf39a7dcf
If graph is not acyclic, break cycles before finding path 2022-04-25 12:26:18 -05:00
Chris Roberts
2f7a9c5a79
Add support for detecting and breaking cycles in graph 2022-04-25 12:26:18 -05:00
Chris Roberts
3cdac85d91
Allow nil values for input types 2022-04-25 12:26:18 -05:00
Chris Roberts
1256abc7b2
Fix synced folder plugin initialization in mapper 2022-04-25 12:26:18 -05:00
Chris Roberts
2a7e43d269
Fix value usage in the boolean mapper 2022-04-25 12:26:18 -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
53d15203f9
Remove any mapper setup in the initializer 2022-04-25 12:26:17 -05:00
Chris Roberts
1ffbe5c474
When inspecting the broker, don't show details 2022-04-25 12:26:17 -05:00
Paul Hinze
142b1af0cc
Fix local exec pushes in server mode
The local-exec push strategy was assuming it was running from a CLI and
so it wouldn't be a big deal for it to straight up `exec` and replace
its running with the user command. That command will just do its thing
and we want the exit code for the CLI command to match anyways, right?

Sure that works for a shell, but in a GRPC server setting it's decidedly
Not Cool to suddenly swap out the running process!

As you can imagine - the effect of doing this was all sorts of broken
pipes and unexpected EOFs and a very confused @phinze.

Luckily we had a subprocess strategy sitting right there for Windows
compat, so it was just a matter of switching to that in the server
context as well. Long and winding debugging process; simple fix;
just another classic!
2022-04-25 12:26:17 -05:00
Chris Roberts
aa934f4436
Implement known type mappers directly 2022-04-25 12:26:17 -05:00
Chris Roberts
047a7f08d8
Replace auto-generated mappers with direct implementation of subset 2022-04-25 12:26:17 -05:00
Chris Roberts
64ebe30618
Remove string conversion to pathname 2022-04-25 12:26:17 -05:00
Chris Roberts
998432faee
Include source type when failed to reach destination 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