Get parents chain from guest plugin
This commit is contained in:
parent
34637c616e
commit
29f14c98b7
@ -64,15 +64,26 @@ module VagrantPlugins
|
||||
)
|
||||
end
|
||||
|
||||
def get_parent_chain(plugin_name)
|
||||
chain = [plugin_name]
|
||||
plugins = Vagrant.plugin("2").manager.guests[plugin_name.to_s.to_sym].to_a
|
||||
if plugins.last.nil?
|
||||
return chain
|
||||
else
|
||||
chain + get_parent_chain(plugins.last)
|
||||
end
|
||||
end
|
||||
|
||||
def parents(req, ctx)
|
||||
ServiceInfo.with_info(ctx) do |info|
|
||||
plugin_name = info.plugin_name
|
||||
plugin = Vagrant.plugin("2").manager.guests[plugin_name.to_s.to_sym].to_a.first
|
||||
if !plugin
|
||||
plugin = Vagrant.plugin("2").manager.guests[plugin_name.to_s.to_sym].to_a
|
||||
if !plugin.first
|
||||
raise "Failed to locate guest plugin for: #{plugin_name.inspect}"
|
||||
end
|
||||
guest_chain = get_parent_chain(plugin_name.to_s.to_sym)
|
||||
SDK::Platform::ParentsResp.new(
|
||||
parents: plugin.new.cap_host_chain
|
||||
parents: guest_chain
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user