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.
This commit is contained in:
Chris Roberts 2022-07-07 14:03:56 -07:00
parent 59a8e9bb0f
commit f5d778d51a
10 changed files with 73 additions and 233 deletions

View File

@ -656,34 +656,19 @@ func (b *Basis) Host() (host core.Host, err error) {
// information before an actual command is run
func (b *Basis) Init() (result *vagrant_server.Job_InitResult, err error) {
b.logger.Debug("running init for basis")
list, err := b.plugins.RubyClient().GetCommands()
if err != nil {
return nil, err
}
existing := map[string]struct{}{}
for _, i := range list {
existing[i.Name] = struct{}{}
}
result = &vagrant_server.Job_InitResult{
Commands: list,
Commands: []*vagrant_plugin_sdk.Command_CommandInfo{},
}
ctx := context.Background()
cmds, err := b.plugins.Typed(component.CommandType)
cmds, err := b.typeComponents(ctx, component.CommandType)
if err != nil {
return nil, err
}
for _, cmdName := range cmds {
if _, ok := existing[cmdName]; ok {
continue
}
c, err := b.component(b.ctx, component.CommandType, cmdName)
if err != nil {
return nil, err
}
for _, c := range cmds {
fn := c.Value.(component.Command).CommandInfoFunc()
raw, err := b.callDynamicFunc(b.ctx, b.logger, fn,
raw, err := b.callDynamicFunc(ctx, b.logger, fn,
(*[]*vagrant_plugin_sdk.Command_CommandInfo)(nil),
argmapper.Typed(b.ctx),
)

View File

@ -47,8 +47,8 @@ type Plugin struct {
Location string // Location of the plugin (generally path to binary)
Mappers []*argmapper.Func // Plugin specific mappers
Name string // Name of the plugin
Options map[component.Type]interface{} // Options for supported components
Types []component.Type // Component types supported by this plugin
Options map[component.Type]interface{} // Options for supported components
cleaner cleanup.Cleanup // Cleanup tasks to perform on closing
logger hclog.Logger

View File

@ -470,53 +470,6 @@ func (x *ParseVagrantfileProviderRequest) GetProvider() string {
return ""
}
type GetCommandsResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Commands []*vagrant_plugin_sdk.Command_CommandInfo `protobuf:"bytes,1,rep,name=commands,proto3" json:"commands,omitempty"`
}
func (x *GetCommandsResponse) Reset() {
*x = GetCommandsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_ruby_vagrant_ruby_server_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetCommandsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetCommandsResponse) ProtoMessage() {}
func (x *GetCommandsResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_ruby_vagrant_ruby_server_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetCommandsResponse.ProtoReflect.Descriptor instead.
func (*GetCommandsResponse) Descriptor() ([]byte, []int) {
return file_proto_ruby_vagrant_ruby_server_proto_rawDescGZIP(), []int{7}
}
func (x *GetCommandsResponse) GetCommands() []*vagrant_plugin_sdk.Command_CommandInfo {
if x != nil {
return x.Commands
}
return nil
}
var File_proto_ruby_vagrant_ruby_server_proto protoreflect.FileDescriptor
var file_proto_ruby_vagrant_ruby_server_proto_rawDesc = []byte{
@ -584,58 +537,47 @@ var file_proto_ruby_vagrant_ruby_server_proto_rawDesc = []byte{
0x64, 0x6b, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x52, 0x61, 0x77, 0x52, 0x75, 0x62,
0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x73, 0x75, 0x62, 0x76, 0x6d, 0x12, 0x1a, 0x0a,
0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x22, 0x5d, 0x0a, 0x13, 0x47, 0x65, 0x74,
0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x46, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76,
0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61,
0x6e, 0x64, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08,
0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x32, 0xff, 0x04, 0x0a, 0x0b, 0x52, 0x75, 0x62,
0x79, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x50,
0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x25,
0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61, 0x67, 0x72, 0x61,
0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d,
0x61, 0x6e, 0x64, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x26, 0x2e, 0x68,
0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74,
0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6b, 0x0a, 0x10, 0x50, 0x61, 0x72, 0x73, 0x65, 0x56, 0x61, 0x67,
0x72, 0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x2a, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69,
0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x72,
0x73, 0x65, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
0x2e, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x56, 0x61,
0x67, 0x72, 0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x73, 0x0a, 0x14, 0x50, 0x61, 0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e,
0x74, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x63, 0x12, 0x2e, 0x2e, 0x68, 0x61, 0x73, 0x68,
0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x50, 0x61,
0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x72,
0x6f, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x68, 0x61, 0x73, 0x68,
0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x50, 0x61,
0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x75, 0x0a, 0x15, 0x50, 0x61, 0x72, 0x73, 0x65, 0x56,
0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x75, 0x62, 0x76, 0x6d, 0x12,
0x2f, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61, 0x67, 0x72,
0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x32, 0xb0, 0x04, 0x0a, 0x0b, 0x52, 0x75,
0x62, 0x79, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0a, 0x47, 0x65, 0x74,
0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a,
0x25, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61, 0x67, 0x72,
0x61, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6b, 0x0a, 0x10, 0x50, 0x61, 0x72, 0x73, 0x65, 0x56,
0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x2a, 0x2e, 0x68, 0x61, 0x73,
0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x50,
0x61, 0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f,
0x72, 0x70, 0x2e, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65,
0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x73, 0x0a, 0x14, 0x50, 0x61, 0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72,
0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x63, 0x12, 0x2e, 0x2e, 0x68, 0x61,
0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e,
0x50, 0x61, 0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65,
0x50, 0x72, 0x6f, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x68, 0x61,
0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e,
0x50, 0x61, 0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x75, 0x0a, 0x15, 0x50, 0x61, 0x72, 0x73,
0x65, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x75, 0x62, 0x76,
0x6d, 0x12, 0x2f, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61,
0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72, 0x61,
0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x75, 0x62, 0x76, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76,
0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72,
0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x7b, 0x0a, 0x18, 0x50, 0x61, 0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x66,
0x69, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x32, 0x2e, 0x68, 0x61,
0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e,
0x50, 0x61, 0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65,
0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x2b, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61, 0x67, 0x72,
0x61, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74,
0x66, 0x69, 0x6c, 0x65, 0x53, 0x75, 0x62, 0x76, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x2b, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61, 0x67,
0x72, 0x61, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e,
0x74, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7b, 0x0a,
0x18, 0x50, 0x61, 0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c,
0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x32, 0x2e, 0x68, 0x61, 0x73, 0x68,
0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x50, 0x61,
0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x72,
0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e,
0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e,
0x74, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x56, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x66, 0x69,
0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x41, 0x5a, 0x3f, 0x67, 0x69,
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f,
0x72, 0x70, 0x2f, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72,
0x6e, 0x61, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x2f, 0x72, 0x75, 0x62, 0x79, 0x5f, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x41, 0x5a, 0x3f,
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69,
0x63, 0x6f, 0x72, 0x70, 0x2f, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x2f, 0x69, 0x6e, 0x74,
0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x2f, 0x72, 0x75, 0x62, 0x79, 0x5f, 0x76, 0x61, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -651,7 +593,7 @@ func file_proto_ruby_vagrant_ruby_server_proto_rawDescGZIP() []byte {
}
var file_proto_ruby_vagrant_ruby_server_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_proto_ruby_vagrant_ruby_server_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_proto_ruby_vagrant_ruby_server_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_proto_ruby_vagrant_ruby_server_proto_goTypes = []interface{}{
(Plugin_Type)(0), // 0: hashicorp.vagrant.Plugin.Type
(*GetPluginsResponse)(nil), // 1: hashicorp.vagrant.GetPluginsResponse
@ -661,40 +603,35 @@ var file_proto_ruby_vagrant_ruby_server_proto_goTypes = []interface{}{
(*ParseVagrantfileResponse)(nil), // 5: hashicorp.vagrant.ParseVagrantfileResponse
(*ParseVagrantfileSubvmRequest)(nil), // 6: hashicorp.vagrant.ParseVagrantfileSubvmRequest
(*ParseVagrantfileProviderRequest)(nil), // 7: hashicorp.vagrant.ParseVagrantfileProviderRequest
(*GetCommandsResponse)(nil), // 8: hashicorp.vagrant.GetCommandsResponse
(*anypb.Any)(nil), // 9: google.protobuf.Any
(*vagrant_plugin_sdk.Args_ProcRef)(nil), // 10: hashicorp.vagrant.sdk.Args.ProcRef
(*vagrant_plugin_sdk.Args_Hash)(nil), // 11: hashicorp.vagrant.sdk.Args.Hash
(*vagrant_plugin_sdk.Config_RawRubyValue)(nil), // 12: hashicorp.vagrant.sdk.Config.RawRubyValue
(*vagrant_plugin_sdk.Command_CommandInfo)(nil), // 13: hashicorp.vagrant.sdk.Command.CommandInfo
(*emptypb.Empty)(nil), // 14: google.protobuf.Empty
(*anypb.Any)(nil), // 8: google.protobuf.Any
(*vagrant_plugin_sdk.Args_ProcRef)(nil), // 9: hashicorp.vagrant.sdk.Args.ProcRef
(*vagrant_plugin_sdk.Args_Hash)(nil), // 10: hashicorp.vagrant.sdk.Args.Hash
(*vagrant_plugin_sdk.Config_RawRubyValue)(nil), // 11: hashicorp.vagrant.sdk.Config.RawRubyValue
(*emptypb.Empty)(nil), // 12: google.protobuf.Empty
}
var file_proto_ruby_vagrant_ruby_server_proto_depIdxs = []int32{
2, // 0: hashicorp.vagrant.GetPluginsResponse.plugins:type_name -> hashicorp.vagrant.Plugin
0, // 1: hashicorp.vagrant.Plugin.type:type_name -> hashicorp.vagrant.Plugin.Type
9, // 2: hashicorp.vagrant.Plugin.options:type_name -> google.protobuf.Any
10, // 3: hashicorp.vagrant.ParseVagrantfileProcRequest.proc:type_name -> hashicorp.vagrant.sdk.Args.ProcRef
11, // 4: hashicorp.vagrant.ParseVagrantfileResponse.data:type_name -> hashicorp.vagrant.sdk.Args.Hash
12, // 5: hashicorp.vagrant.ParseVagrantfileSubvmRequest.subvm:type_name -> hashicorp.vagrant.sdk.Config.RawRubyValue
12, // 6: hashicorp.vagrant.ParseVagrantfileProviderRequest.subvm:type_name -> hashicorp.vagrant.sdk.Config.RawRubyValue
13, // 7: hashicorp.vagrant.GetCommandsResponse.commands:type_name -> hashicorp.vagrant.sdk.Command.CommandInfo
14, // 8: hashicorp.vagrant.RubyVagrant.GetPlugins:input_type -> google.protobuf.Empty
14, // 9: hashicorp.vagrant.RubyVagrant.GetCommands:input_type -> google.protobuf.Empty
3, // 10: hashicorp.vagrant.RubyVagrant.ParseVagrantfile:input_type -> hashicorp.vagrant.ParseVagrantfileRequest
4, // 11: hashicorp.vagrant.RubyVagrant.ParseVagrantfileProc:input_type -> hashicorp.vagrant.ParseVagrantfileProcRequest
6, // 12: hashicorp.vagrant.RubyVagrant.ParseVagrantfileSubvm:input_type -> hashicorp.vagrant.ParseVagrantfileSubvmRequest
7, // 13: hashicorp.vagrant.RubyVagrant.ParseVagrantfileProvider:input_type -> hashicorp.vagrant.ParseVagrantfileProviderRequest
1, // 14: hashicorp.vagrant.RubyVagrant.GetPlugins:output_type -> hashicorp.vagrant.GetPluginsResponse
8, // 15: hashicorp.vagrant.RubyVagrant.GetCommands:output_type -> hashicorp.vagrant.GetCommandsResponse
5, // 16: hashicorp.vagrant.RubyVagrant.ParseVagrantfile:output_type -> hashicorp.vagrant.ParseVagrantfileResponse
5, // 17: hashicorp.vagrant.RubyVagrant.ParseVagrantfileProc:output_type -> hashicorp.vagrant.ParseVagrantfileResponse
5, // 18: hashicorp.vagrant.RubyVagrant.ParseVagrantfileSubvm:output_type -> hashicorp.vagrant.ParseVagrantfileResponse
5, // 19: hashicorp.vagrant.RubyVagrant.ParseVagrantfileProvider:output_type -> hashicorp.vagrant.ParseVagrantfileResponse
14, // [14:20] is the sub-list for method output_type
8, // [8:14] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
8, // 2: hashicorp.vagrant.Plugin.options:type_name -> google.protobuf.Any
9, // 3: hashicorp.vagrant.ParseVagrantfileProcRequest.proc:type_name -> hashicorp.vagrant.sdk.Args.ProcRef
10, // 4: hashicorp.vagrant.ParseVagrantfileResponse.data:type_name -> hashicorp.vagrant.sdk.Args.Hash
11, // 5: hashicorp.vagrant.ParseVagrantfileSubvmRequest.subvm:type_name -> hashicorp.vagrant.sdk.Config.RawRubyValue
11, // 6: hashicorp.vagrant.ParseVagrantfileProviderRequest.subvm:type_name -> hashicorp.vagrant.sdk.Config.RawRubyValue
12, // 7: hashicorp.vagrant.RubyVagrant.GetPlugins:input_type -> google.protobuf.Empty
3, // 8: hashicorp.vagrant.RubyVagrant.ParseVagrantfile:input_type -> hashicorp.vagrant.ParseVagrantfileRequest
4, // 9: hashicorp.vagrant.RubyVagrant.ParseVagrantfileProc:input_type -> hashicorp.vagrant.ParseVagrantfileProcRequest
6, // 10: hashicorp.vagrant.RubyVagrant.ParseVagrantfileSubvm:input_type -> hashicorp.vagrant.ParseVagrantfileSubvmRequest
7, // 11: hashicorp.vagrant.RubyVagrant.ParseVagrantfileProvider:input_type -> hashicorp.vagrant.ParseVagrantfileProviderRequest
1, // 12: hashicorp.vagrant.RubyVagrant.GetPlugins:output_type -> hashicorp.vagrant.GetPluginsResponse
5, // 13: hashicorp.vagrant.RubyVagrant.ParseVagrantfile:output_type -> hashicorp.vagrant.ParseVagrantfileResponse
5, // 14: hashicorp.vagrant.RubyVagrant.ParseVagrantfileProc:output_type -> hashicorp.vagrant.ParseVagrantfileResponse
5, // 15: hashicorp.vagrant.RubyVagrant.ParseVagrantfileSubvm:output_type -> hashicorp.vagrant.ParseVagrantfileResponse
5, // 16: hashicorp.vagrant.RubyVagrant.ParseVagrantfileProvider:output_type -> hashicorp.vagrant.ParseVagrantfileResponse
12, // [12:17] is the sub-list for method output_type
7, // [7:12] is the sub-list for method input_type
7, // [7:7] is the sub-list for extension type_name
7, // [7:7] is the sub-list for extension extendee
0, // [0:7] is the sub-list for field type_name
}
func init() { file_proto_ruby_vagrant_ruby_server_proto_init() }
@ -787,18 +724,6 @@ func file_proto_ruby_vagrant_ruby_server_proto_init() {
return nil
}
}
file_proto_ruby_vagrant_ruby_server_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetCommandsResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -806,7 +731,7 @@ func file_proto_ruby_vagrant_ruby_server_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_proto_ruby_vagrant_ruby_server_proto_rawDesc,
NumEnums: 1,
NumMessages: 8,
NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},

View File

@ -14,7 +14,6 @@ import "plugin.proto";
service RubyVagrant {
// Gets available ruby plugins
rpc GetPlugins(google.protobuf.Empty) returns (GetPluginsResponse);
rpc GetCommands(google.protobuf.Empty) returns (GetCommandsResponse);
rpc ParseVagrantfile(ParseVagrantfileRequest) returns (ParseVagrantfileResponse);
rpc ParseVagrantfileProc(ParseVagrantfileProcRequest) returns (ParseVagrantfileResponse);
rpc ParseVagrantfileSubvm(ParseVagrantfileSubvmRequest) returns (ParseVagrantfileResponse);
@ -87,7 +86,3 @@ message ParseVagrantfileProviderRequest {
sdk.Config.RawRubyValue subvm = 1;
string provider = 2;
}
message GetCommandsResponse {
repeated sdk.Command.CommandInfo commands = 1;
}

View File

@ -25,7 +25,6 @@ const _ = grpc.SupportPackageIsVersion7
type RubyVagrantClient interface {
// Gets available ruby plugins
GetPlugins(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetPluginsResponse, error)
GetCommands(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetCommandsResponse, error)
ParseVagrantfile(ctx context.Context, in *ParseVagrantfileRequest, opts ...grpc.CallOption) (*ParseVagrantfileResponse, error)
ParseVagrantfileProc(ctx context.Context, in *ParseVagrantfileProcRequest, opts ...grpc.CallOption) (*ParseVagrantfileResponse, error)
ParseVagrantfileSubvm(ctx context.Context, in *ParseVagrantfileSubvmRequest, opts ...grpc.CallOption) (*ParseVagrantfileResponse, error)
@ -49,15 +48,6 @@ func (c *rubyVagrantClient) GetPlugins(ctx context.Context, in *emptypb.Empty, o
return out, nil
}
func (c *rubyVagrantClient) GetCommands(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetCommandsResponse, error) {
out := new(GetCommandsResponse)
err := c.cc.Invoke(ctx, "/hashicorp.vagrant.RubyVagrant/GetCommands", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *rubyVagrantClient) ParseVagrantfile(ctx context.Context, in *ParseVagrantfileRequest, opts ...grpc.CallOption) (*ParseVagrantfileResponse, error) {
out := new(ParseVagrantfileResponse)
err := c.cc.Invoke(ctx, "/hashicorp.vagrant.RubyVagrant/ParseVagrantfile", in, out, opts...)
@ -100,7 +90,6 @@ func (c *rubyVagrantClient) ParseVagrantfileProvider(ctx context.Context, in *Pa
type RubyVagrantServer interface {
// Gets available ruby plugins
GetPlugins(context.Context, *emptypb.Empty) (*GetPluginsResponse, error)
GetCommands(context.Context, *emptypb.Empty) (*GetCommandsResponse, error)
ParseVagrantfile(context.Context, *ParseVagrantfileRequest) (*ParseVagrantfileResponse, error)
ParseVagrantfileProc(context.Context, *ParseVagrantfileProcRequest) (*ParseVagrantfileResponse, error)
ParseVagrantfileSubvm(context.Context, *ParseVagrantfileSubvmRequest) (*ParseVagrantfileResponse, error)
@ -115,9 +104,6 @@ type UnimplementedRubyVagrantServer struct {
func (UnimplementedRubyVagrantServer) GetPlugins(context.Context, *emptypb.Empty) (*GetPluginsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetPlugins not implemented")
}
func (UnimplementedRubyVagrantServer) GetCommands(context.Context, *emptypb.Empty) (*GetCommandsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCommands not implemented")
}
func (UnimplementedRubyVagrantServer) ParseVagrantfile(context.Context, *ParseVagrantfileRequest) (*ParseVagrantfileResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ParseVagrantfile not implemented")
}
@ -161,24 +147,6 @@ func _RubyVagrant_GetPlugins_Handler(srv interface{}, ctx context.Context, dec f
return interceptor(ctx, in, info, handler)
}
func _RubyVagrant_GetCommands_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RubyVagrantServer).GetCommands(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/hashicorp.vagrant.RubyVagrant/GetCommands",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RubyVagrantServer).GetCommands(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
func _RubyVagrant_ParseVagrantfile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ParseVagrantfileRequest)
if err := dec(in); err != nil {
@ -262,10 +230,6 @@ var RubyVagrant_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetPlugins",
Handler: _RubyVagrant_GetPlugins_Handler,
},
{
MethodName: "GetCommands",
Handler: _RubyVagrant_GetCommands_Handler,
},
{
MethodName: "ParseVagrantfile",
Handler: _RubyVagrant_ParseVagrantfile_Handler,

View File

@ -121,16 +121,3 @@ func (r *RubyVagrantClient) ParseVagrantfileProvider(provider string, subvm *vag
return resp.Data, nil
}
func (r *RubyVagrantClient) GetCommands() ([]*vagrant_plugin_sdk.Command_CommandInfo, error) {
resp, err := r.client.GetCommands(
context.Background(),
&emptypb.Empty{},
)
if err != nil {
return nil, err
}
return resp.Commands, nil
}

View File

@ -50,9 +50,6 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
optional :subvm, :message, 1, "hashicorp.vagrant.sdk.Config.RawRubyValue"
optional :provider, :string, 2
end
add_message "hashicorp.vagrant.GetCommandsResponse" do
repeated :commands, :message, 1, "hashicorp.vagrant.sdk.Command.CommandInfo"
end
end
end
@ -66,6 +63,5 @@ module Hashicorp
ParseVagrantfileResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.ParseVagrantfileResponse").msgclass
ParseVagrantfileSubvmRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.ParseVagrantfileSubvmRequest").msgclass
ParseVagrantfileProviderRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.ParseVagrantfileProviderRequest").msgclass
GetCommandsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.GetCommandsResponse").msgclass
end
end

View File

@ -18,7 +18,6 @@ module Hashicorp
# Gets available ruby plugins
rpc :GetPlugins, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::GetPluginsResponse
rpc :GetCommands, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::GetCommandsResponse
rpc :ParseVagrantfile, ::Hashicorp::Vagrant::ParseVagrantfileRequest, ::Hashicorp::Vagrant::ParseVagrantfileResponse
rpc :ParseVagrantfileProc, ::Hashicorp::Vagrant::ParseVagrantfileProcRequest, ::Hashicorp::Vagrant::ParseVagrantfileResponse
rpc :ParseVagrantfileSubvm, ::Hashicorp::Vagrant::ParseVagrantfileSubvmRequest, ::Hashicorp::Vagrant::ParseVagrantfileResponse

View File

@ -128,7 +128,6 @@ module VagrantPlugins
STDOUT.flush
logger.info("Vagrant GRPC service is now running addr=#{bind_addr.inspect} port=#{port.inspect}")
s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT', 'SIGINT'])
1
ensure
logger.info("Vagrant GRPC service is shutting down")
end

View File

@ -87,16 +87,6 @@ module VagrantPlugins
parse_item_to_proto(overrides)
end
def get_commands(req, _)
s = CommandService.new(broker: :stub)
infos = Vagrant.plugin("2").local_manager.commands.keys.map do |n|
s.send(:collect_command_info, n.to_s, [])
end
Hashicorp::Vagrant::GetCommandsResponse.new(
commands: infos,
)
end
def parse_item(item)
loader = Vagrant::Config::Loader.new(
Vagrant::Config::VERSIONS,