mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-05-28 04:36:05 -04:00
Add machine to_proto mapper and update from target
This commit is contained in:
parent
b7c04b4ecc
commit
ce3f18ada1
1 changed files with 19 additions and 4 deletions
|
|
@ -53,13 +53,13 @@ module VagrantPlugins
|
|||
class MachineFromTarget < Mapper
|
||||
def initialize
|
||||
inputs = [].tap do |i|
|
||||
i << Input.new(type: Vagrant::Environment)
|
||||
i << Input.new(type: Client::Target)
|
||||
i << Input.new(type: Vagrant::Environment)
|
||||
end
|
||||
super(inputs: inputs, output: Vagrant::Machine, func: method(:converter))
|
||||
end
|
||||
|
||||
def converter(env, target)
|
||||
def converter(target, env)
|
||||
env.machine(
|
||||
target.name.to_sym,
|
||||
target.provider_name.to_sym,
|
||||
|
|
@ -71,19 +71,34 @@ module VagrantPlugins
|
|||
class MachineFromMachineClient < Mapper
|
||||
def initialize
|
||||
inputs = [].tap do |i|
|
||||
i << Input.new(type: Vagrant::Environment)
|
||||
i << Input.new(type: Client::Target::Machine)
|
||||
i << Input.new(type: Mappers)
|
||||
end
|
||||
super(inputs: inputs, output: Vagrant::Machine, func: method(:converter))
|
||||
end
|
||||
|
||||
def converter(env, machine)
|
||||
def converter(machine, mappers)
|
||||
env = mappers.map(machine.project, to: Vagrant::Environment)
|
||||
env.machine(
|
||||
machine.name.to_sym,
|
||||
machine.provider_name.to_sym,
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class MachineToProto < Mapper
|
||||
def initialize
|
||||
super(
|
||||
inputs: [Input.new(type:Client::Target::Machine)],
|
||||
output: SDK::Args::Target::Machine,
|
||||
func: method(:converter),
|
||||
)
|
||||
end
|
||||
|
||||
def converter(m)
|
||||
m.to_proto
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue