Add mappers for synced folder client -> vagrant synced folder

This commit is contained in:
sophia 2021-12-22 13:38:12 -06:00 committed by Paul Hinze
parent 4bb170fba3
commit a3c3bb9cf1
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
2 changed files with 16 additions and 1 deletions

View File

@ -22,6 +22,7 @@ module VagrantPlugins
Client::Project => Vagrant::Environment,
Client::Target => Vagrant::Machine,
Client::Terminal => Vagrant::UI::Remote,
Client::SyncedFolder => Vagrant::Plugin::V2::SyncedFolder,
}
include Util::HasLogger

View File

@ -30,7 +30,7 @@ module VagrantPlugins
end
# Build a synced folder client from a proto instance
class SyncedFolderFromProto < Mapper
class SyncedFolderClientFromProto < Mapper
def initialize
inputs = [].tap do |i|
i << Input.new(type: SDK::Args::SyncedFolder)
@ -64,6 +64,20 @@ module VagrantPlugins
Client::SyncedFolder.load(proto, broker: broker)
end
end
# Build a synced folder from a synced folder client
class SyncedFolderFromProto < Mapper
def initialize
inputs = [].tap do |i|
i << Input.new(type: Client::SyncedFolder)
end
super(inputs: inputs, output: Vagrant::Plugin::V2::SyncedFolder, func: method(:converter))
end
def converter(client)
Vagrant::Plugin::V2::SyncedFolder.new(client)
end
end
end
end
end