Skip to content

Commit

Permalink
Let the api to choose the default network driver.
Browse files Browse the repository at this point in the history
That way swarm can understand the user's intention.

Signed-off-by: David Calavera <david.calavera@gmail.com>
  • Loading branch information
calavera committed Oct 29, 2015
1 parent 7f7950a commit 34668ad
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api/client/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ func (cli *DockerCli) CmdNetworkCreate(args ...string) error {
return err
}

// Set the default driver to "" if the user didn't set the value.
// That way we can know whether it was user input or not.
driver := *flDriver
if !cmd.IsSet("-driver") && !cmd.IsSet("d") {
driver = ""
}

ipamCfg, err := consolidateIpam(flIpamSubnet.GetAll(), flIpamIPRange.GetAll(), flIpamGateway.GetAll(), flIpamAux.GetAll())
if err != nil {
return err
Expand All @@ -62,7 +69,7 @@ func (cli *DockerCli) CmdNetworkCreate(args ...string) error {
// Construct network create request body
nc := types.NetworkCreate{
Name: cmd.Arg(0),
Driver: *flDriver,
Driver: driver,
IPAM: network.IPAM{Driver: *flIpamDriver, Config: ipamCfg},
Options: flOpts.GetAll(),
CheckDuplicate: true,
Expand Down

0 comments on commit 34668ad

Please sign in to comment.