Skip to content

Commit

Permalink
Check if DriverState is valid before using in convert
Browse files Browse the repository at this point in the history
Signed-off-by: Jana Radhakrishnan <[email protected]>
  • Loading branch information
mrjana committed Jun 17, 2016
1 parent 8f9c7fa commit 4fea811
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions daemon/cluster/convert/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,22 @@ func BasicNetworkFromGRPC(n swarmapi.Network) basictypes.NetworkResource {
}
}

return basictypes.NetworkResource{
nr := basictypes.NetworkResource{
ID: n.ID,
Name: n.Spec.Annotations.Name,
Scope: "swarm",
Driver: n.DriverState.Name,
EnableIPv6: spec.Ipv6Enabled,
IPAM: ipam,
Internal: spec.Internal,
Options: n.DriverState.Options,
Labels: n.Spec.Annotations.Labels,
}

if n.DriverState != nil {
nr.Driver = n.DriverState.Name
nr.Options = n.DriverState.Options
}

return nr
}

// BasicNetworkCreateToGRPC converts a NetworkCreateRequest to a grpc NetworkSpec.
Expand Down

0 comments on commit 4fea811

Please sign in to comment.