Update docker network action to auto-generate cli flags

This commit updates the docker network behavior to auto-generate the
docker network command flags from Vagrants network config option.
This commit is contained in:
Brian Cain 2019-02-28 14:53:36 -08:00
parent b5a092397f
commit 4a0f1a0a33
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
1 changed files with 7 additions and 7 deletions

View File

@ -45,16 +45,16 @@ module VagrantPlugins
def parse_cli_arguments(options) def parse_cli_arguments(options)
cli_opts = {create: [], connect: []} cli_opts = {create: [], connect: []}
# make this a function that generates the proper flags # Splits the networking options to generate the proper CLI flags for docker
if options[:type] != "dhcp" if options[:type] != "dhcp"
if options[:docker__subnet] options.each do |opt, value|
cli_opts[:create].concat(["--subnet", options[:docker__subnet]]) vals = opt.to_s.split("__")
end if vals[0] == "docker" && vals.size == 3
cli_opts[vals[1].to_sym].concat(["--#{vals[2]}", value])
if options[:docker__ip] end
cli_opts[:connect].concat(["--ip", options[:docker__ip]])
end end
end end
return cli_opts return cli_opts
end end