Skip to content

Commit 516117b

Browse files
committed
Load local plugins
1 parent 349ceca commit 516117b

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/vagrant/plugin/v2/manager.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ def initialize
1414
@registered = []
1515
end
1616

17+
def initialize_clone(org)
18+
super
19+
@registered = org.registered.dup
20+
end
21+
1722
# This returns all the action hooks.
1823
#
1924
# @return [Array]

plugins/commands/serve/service/internal_service.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,21 @@ def get_global_plugins(req, _)
5858

5959
def get_local_plugins(req, _)
6060
env = vagrant_env(req.project_path)
61-
plugin_manager = Vagrant::Plugin::V2::Plugin.local_manager
6261
localized_plugins = Vagrant::Plugin::Manager.instance.localize!(env)
6362
Vagrant::Plugin::Manager.instance.load_plugins(localized_plugins)
63+
plugin_manager = Vagrant::Plugin::V2::Plugin.local_manager.clone
64+
65+
# TODO: do this better
66+
to_remove = []
67+
plugin_manager.registered.each do |p|
68+
if p.inspect.start_with?("VagrantPlugins")
69+
to_remove << p
70+
end
71+
end
72+
to_remove.each do |p|
73+
plugin_manager.unregister(p)
74+
end
75+
6476
extract_plugin_protos(plugin_manager)
6577
end
6678

0 commit comments

Comments
 (0)