Return a result from an up action

This commit is contained in:
sophia 2021-01-08 13:40:39 -06:00 committed by Paul Hinze
parent e56013a6b4
commit 41f3af51af
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
4 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,18 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: plugin_server.proto
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("plugin_server.proto", :syntax => :proto3) do
add_message "hashicorp.vagrant.UpResult" do
optional :success, :bool, 1
end
end
end
module Hashicorp
module Vagrant
UpResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.UpResult").msgclass
end
end

View File

@ -0,0 +1,8 @@
syntax = "proto3";
package hashicorp.vagrant;
message UpResult {
bool success = 1;
}

View File

@ -3,3 +3,9 @@
These are plugins that ship with Vagrant. Vagrant core uses its own
plugin system to power a lot of the core pieces that ship with Vagrant.
Each plugin will have its own README which explains its specific role.
## Generate proto
```
grpc_tools_ruby_protoc -I . --ruby_out=gen/plugin --grpc_out=gen/plugin ./plugin_server.proto
```

View File

@ -1,6 +1,7 @@
require 'proto/gen/plugin/plugin_pb'
require 'proto/gen/plugin/plugin_services_pb'
require 'proto/gen/plugin/plugin_server_pb'
require 'vagrant/machine'
require 'logger'
@ -37,6 +38,7 @@ module VagrantPlugins
def action_up(req, _unused_call)
machine = machine_arg_to_machine(req)
LOG.debug(machine)
Hashicorp::Vagrant::UpResult.new(success: true)
end
def machine_arg_to_machine(req)
@ -60,8 +62,12 @@ module VagrantPlugins
),
]
result = [
nil,
Hashicorp::Vagrant::Sdk::FuncSpec::Value.new(
type: "hashicorp.vagrant.UpResult",
name: ""
),
]
Hashicorp::Vagrant::Sdk::FuncSpec.new(
args: args,
result: result