remove redundant alias for libnetwork/datastore imports

These aliases were not needed, and only used in a couple of places,
which made it inconsistent, so let's use the import without aliasing.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-07-03 23:47:40 +02:00
parent 46c7319f02
commit 9f4acceb6a
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
4 changed files with 9 additions and 9 deletions

View file

@ -13,7 +13,7 @@ import (
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/libnetwork"
netconst "github.com/docker/docker/libnetwork/datastore"
"github.com/docker/docker/libnetwork/datastore"
"github.com/pkg/errors"
)
@ -144,7 +144,7 @@ func (n *networkRouter) getNetwork(ctx context.Context, w http.ResponseWriter, r
// or if the get network was passed with a network name and scope as swarm
// return the network. Skipped using isMatchingScope because it is true if the scope
// is not set which would be case if the client API v1.30
if strings.HasPrefix(nwk.ID, term) || (netconst.SwarmScope == scope) {
if strings.HasPrefix(nwk.ID, term) || (datastore.SwarmScope == scope) {
// If we have a previous match "backend", return it, we need verbose when enabled
// ex: overlay/partial_ID or name/swarm_scope
if nwv, ok := listByPartialID[nwk.ID]; ok {

View file

@ -6,7 +6,7 @@ import (
basictypes "github.com/docker/docker/api/types"
networktypes "github.com/docker/docker/api/types/network"
types "github.com/docker/docker/api/types/swarm"
netconst "github.com/docker/docker/libnetwork/datastore"
"github.com/docker/docker/libnetwork/datastore"
gogotypes "github.com/gogo/protobuf/types"
swarmapi "github.com/moby/swarmkit/v2/api"
)
@ -31,7 +31,7 @@ func networkFromGRPC(n *swarmapi.Network) types.Network {
Attachable: n.Spec.Attachable,
Ingress: IsIngressNetwork(n),
IPAMOptions: ipamFromGRPC(n.Spec.IPAM),
Scope: netconst.SwarmScope,
Scope: datastore.SwarmScope,
},
IPAMOptions: ipamFromGRPC(n.IPAM),
}
@ -160,7 +160,7 @@ func BasicNetworkFromGRPC(n swarmapi.Network) basictypes.NetworkResource {
nr := basictypes.NetworkResource{
ID: n.ID,
Name: n.Spec.Annotations.Name,
Scope: netconst.SwarmScope,
Scope: datastore.SwarmScope,
EnableIPv6: spec.Ipv6Enabled,
IPAM: ipam,
Internal: spec.Internal,

View file

@ -20,7 +20,7 @@ import (
"github.com/docker/docker/daemon/cluster/convert"
executorpkg "github.com/docker/docker/daemon/cluster/executor"
clustertypes "github.com/docker/docker/daemon/cluster/provider"
netconst "github.com/docker/docker/libnetwork/datastore"
"github.com/docker/docker/libnetwork/datastore"
"github.com/docker/go-connections/nat"
"github.com/docker/go-units"
gogotypes "github.com/gogo/protobuf/types"
@ -645,7 +645,7 @@ func (c *containerConfig) networkCreateRequest(name string) (clustertypes.Networ
Ingress: convert.IsIngressNetwork(na.Network),
EnableIPv6: na.Network.Spec.Ipv6Enabled,
CheckDuplicate: true,
Scope: netconst.SwarmScope,
Scope: datastore.SwarmScope,
}
if na.Network.Spec.GetNetwork() != "" {

View file

@ -18,7 +18,7 @@ import (
"github.com/docker/docker/daemon/network"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/libnetwork"
netconst "github.com/docker/docker/libnetwork/datastore"
"github.com/docker/docker/libnetwork/datastore"
"github.com/docker/docker/libnetwork/netlabel"
"github.com/docker/docker/libnetwork/options"
"github.com/docker/docker/libnetwork/types"
@ -270,7 +270,7 @@ func (daemon *Daemon) updateNetworkSettings(container *container.Container, n li
// is an attachable network, which may not
// be locally available previously.
// So always update.
if n.Info().Scope() == netconst.SwarmScope {
if n.Info().Scope() == datastore.SwarmScope {
continue
}
// Avoid duplicate config