Update how docker network handles processing options to cli arguments
Add an "ignored option" array rather than a big if-statement expression
This commit is contained in:
parent
953a380371
commit
cccbedf4ce
|
@ -13,12 +13,12 @@ module VagrantPlugins
|
||||||
# @returns[Array] cli_opts - an array of strings used for the network commnad
|
# @returns[Array] cli_opts - an array of strings used for the network commnad
|
||||||
def generate_create_cli_arguments(options)
|
def generate_create_cli_arguments(options)
|
||||||
cli_opts = []
|
cli_opts = []
|
||||||
|
ignored_options = ["ip", "protocol", "id", "alias"]
|
||||||
|
|
||||||
# Splits the networking options to generate the proper CLI flags for docker
|
# Splits the networking options to generate the proper CLI flags for docker
|
||||||
options.each do |opt, value|
|
options.each do |opt, value|
|
||||||
opt = opt.to_s
|
opt = opt.to_s
|
||||||
if opt == "ip" || (opt == "type" && value == "dhcp") ||
|
if (opt == "type" && value == "dhcp") || ignored_options.include?(opt)
|
||||||
opt == "protocol" || opt == "id"
|
|
||||||
# `docker network create` doesn't care about these options
|
# `docker network create` doesn't care about these options
|
||||||
next
|
next
|
||||||
else
|
else
|
||||||
|
@ -40,6 +40,10 @@ module VagrantPlugins
|
||||||
cli_opts = ["--ip6", options[:ip6]]
|
cli_opts = ["--ip6", options[:ip6]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if options[:alias]
|
||||||
|
cli_opts.concat(["--alias=#{options[:alias]}"])
|
||||||
|
end
|
||||||
|
|
||||||
return cli_opts
|
return cli_opts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue