29 lines
936 B
Ruby
29 lines
936 B
Ruby
require "vagrant/plugin/v2/plugin"
|
|
|
|
module VagrantPlugins
|
|
module CommandServe
|
|
module Service
|
|
class InternalService < Hashicorp::Vagrant::RubyVagrant::Service
|
|
def get_plugins(req, _unused_call)
|
|
plugins = []
|
|
plugin_manager = Vagrant::Plugin::V2::Plugin.manager
|
|
plugins = [[:commands, :COMMAND],
|
|
[:communicators, :COMMUNICATOR],
|
|
[:guests, :GUEST],
|
|
[:hosts, :HOST],
|
|
[:providers, :PROVIDER],
|
|
[:provisioners, :PROVISIONER],
|
|
[:synced_folders, :SYNCED_FOLDER]].map do |method, const|
|
|
plugin_manager.send(method).map do |k, v|
|
|
Hashicorp::Vagrant::Plugin.new(name: k, type: Hashicorp::Vagrant::Plugin::Type.const_get(const))
|
|
end
|
|
end.flatten
|
|
Hashicorp::Vagrant::GetPluginsResponse.new(
|
|
plugins: plugins
|
|
)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|