mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Check if DriverState is valid before using in convert
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
This commit is contained in:
parent
8f9c7fab24
commit
4fea81154b
1 changed files with 8 additions and 3 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue