mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
fix redefines-builtin-id from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
committed by
Cory Snider
parent
e53cf6bc02
commit
bacba3726f
@@ -61,6 +61,7 @@ linters-settings:
|
||||
# FIXME make sure all packages have a description. Currently, there's many packages without.
|
||||
- name: package-comments
|
||||
disabled: true
|
||||
- name: redefines-builtin-id
|
||||
issues:
|
||||
# The default exclusion rules are a bit too permissive, so copying the relevant ones below
|
||||
exclude-use-default: false
|
||||
|
||||
@@ -278,38 +278,38 @@ func withoutHealthcheck() runConfigModifier {
|
||||
}
|
||||
|
||||
func copyRunConfig(runConfig *container.Config, modifiers ...runConfigModifier) *container.Config {
|
||||
copy := *runConfig
|
||||
copy.Cmd = copyStringSlice(runConfig.Cmd)
|
||||
copy.Env = copyStringSlice(runConfig.Env)
|
||||
copy.Entrypoint = copyStringSlice(runConfig.Entrypoint)
|
||||
copy.OnBuild = copyStringSlice(runConfig.OnBuild)
|
||||
copy.Shell = copyStringSlice(runConfig.Shell)
|
||||
c := *runConfig
|
||||
c.Cmd = copyStringSlice(runConfig.Cmd)
|
||||
c.Env = copyStringSlice(runConfig.Env)
|
||||
c.Entrypoint = copyStringSlice(runConfig.Entrypoint)
|
||||
c.OnBuild = copyStringSlice(runConfig.OnBuild)
|
||||
c.Shell = copyStringSlice(runConfig.Shell)
|
||||
|
||||
if copy.Volumes != nil {
|
||||
copy.Volumes = make(map[string]struct{}, len(runConfig.Volumes))
|
||||
if c.Volumes != nil {
|
||||
c.Volumes = make(map[string]struct{}, len(runConfig.Volumes))
|
||||
for k, v := range runConfig.Volumes {
|
||||
copy.Volumes[k] = v
|
||||
c.Volumes[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
if copy.ExposedPorts != nil {
|
||||
copy.ExposedPorts = make(nat.PortSet, len(runConfig.ExposedPorts))
|
||||
if c.ExposedPorts != nil {
|
||||
c.ExposedPorts = make(nat.PortSet, len(runConfig.ExposedPorts))
|
||||
for k, v := range runConfig.ExposedPorts {
|
||||
copy.ExposedPorts[k] = v
|
||||
c.ExposedPorts[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
if copy.Labels != nil {
|
||||
copy.Labels = make(map[string]string, len(runConfig.Labels))
|
||||
if c.Labels != nil {
|
||||
c.Labels = make(map[string]string, len(runConfig.Labels))
|
||||
for k, v := range runConfig.Labels {
|
||||
copy.Labels[k] = v
|
||||
c.Labels[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
for _, modifier := range modifiers {
|
||||
modifier(©)
|
||||
modifier(&c)
|
||||
}
|
||||
return ©
|
||||
return &c
|
||||
}
|
||||
|
||||
func copyStringSlice(orig []string) []string {
|
||||
|
||||
@@ -166,17 +166,17 @@ func fullMutableRunConfig() *container.Config {
|
||||
|
||||
func TestDeepCopyRunConfig(t *testing.T) {
|
||||
runConfig := fullMutableRunConfig()
|
||||
copy := copyRunConfig(runConfig)
|
||||
assert.Check(t, is.DeepEqual(fullMutableRunConfig(), copy))
|
||||
deepCopy := copyRunConfig(runConfig)
|
||||
assert.Check(t, is.DeepEqual(fullMutableRunConfig(), deepCopy))
|
||||
|
||||
copy.Cmd[1] = "arg2"
|
||||
copy.Env[1] = "env2=new"
|
||||
copy.ExposedPorts["10002"] = struct{}{}
|
||||
copy.Volumes["three"] = struct{}{}
|
||||
copy.Entrypoint[1] = "arg2"
|
||||
copy.OnBuild[0] = "start"
|
||||
copy.Labels["label3"] = "value3"
|
||||
copy.Shell[0] = "sh"
|
||||
deepCopy.Cmd[1] = "arg2"
|
||||
deepCopy.Env[1] = "env2=new"
|
||||
deepCopy.ExposedPorts["10002"] = struct{}{}
|
||||
deepCopy.Volumes["three"] = struct{}{}
|
||||
deepCopy.Entrypoint[1] = "arg2"
|
||||
deepCopy.OnBuild[0] = "start"
|
||||
deepCopy.Labels["label3"] = "value3"
|
||||
deepCopy.Shell[0] = "sh"
|
||||
assert.Check(t, is.DeepEqual(fullMutableRunConfig(), runConfig))
|
||||
}
|
||||
|
||||
|
||||
@@ -46,11 +46,11 @@ func (s *Health) Status() string {
|
||||
// obeying the locking semantics.
|
||||
//
|
||||
// Status may be set directly if another lock is used.
|
||||
func (s *Health) SetStatus(new string) {
|
||||
func (s *Health) SetStatus(healthStatus string) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
s.Health.Status = new
|
||||
s.Health.Status = healthStatus
|
||||
}
|
||||
|
||||
// OpenMonitorChannel creates and returns a new monitor channel. If there
|
||||
|
||||
@@ -225,16 +225,16 @@ func (j *Journal) Data() (map[string]string, error) {
|
||||
for {
|
||||
var (
|
||||
data unsafe.Pointer
|
||||
len C.size_t
|
||||
length C.size_t
|
||||
)
|
||||
rc := C.sd_journal_enumerate_data(j.j, &data, &len)
|
||||
rc := C.sd_journal_enumerate_data(j.j, &data, &length)
|
||||
if rc == 0 {
|
||||
return m, nil
|
||||
} else if rc < 0 {
|
||||
return m, fmt.Errorf("journald: error enumerating entry data: %w", syscall.Errno(-rc))
|
||||
}
|
||||
|
||||
k, v, _ := strings.Cut(C.GoStringN((*C.char)(data), C.int(len)), "=")
|
||||
k, v, _ := strings.Cut(C.GoStringN((*C.char)(data), C.int(length)), "=")
|
||||
m[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,10 +102,10 @@ func New(info logger.Info) (logger.Logger, error) {
|
||||
return nil, fmt.Errorf("journald is not enabled on this host")
|
||||
}
|
||||
|
||||
return new(info)
|
||||
return newJournald(info)
|
||||
}
|
||||
|
||||
func new(info logger.Info) (*journald, error) {
|
||||
func newJournald(info logger.Info) (*journald, error) {
|
||||
// parse log tag
|
||||
tag, err := loggerutils.ParseLogTag(info, loggerutils.DefaultTemplate)
|
||||
if err != nil {
|
||||
|
||||
@@ -24,7 +24,7 @@ func TestLogRead(t *testing.T) {
|
||||
// LogReader needs to filter out.
|
||||
rotatedJournal := fake.NewT(t, journalDir+"/rotated.journal")
|
||||
rotatedJournal.AssignEventTimestampFromSyslogTimestamp = true
|
||||
l, err := new(logger.Info{
|
||||
l, err := newJournald(logger.Info{
|
||||
ContainerID: "wrongone0001",
|
||||
ContainerName: "fake",
|
||||
})
|
||||
@@ -36,7 +36,7 @@ func TestLogRead(t *testing.T) {
|
||||
|
||||
activeJournal := fake.NewT(t, journalDir+"/fake.journal")
|
||||
activeJournal.AssignEventTimestampFromSyslogTimestamp = true
|
||||
l, err = new(logger.Info{
|
||||
l, err = newJournald(logger.Info{
|
||||
ContainerID: "wrongone0002",
|
||||
ContainerName: "fake",
|
||||
})
|
||||
@@ -47,7 +47,7 @@ func TestLogRead(t *testing.T) {
|
||||
assert.NilError(t, rotatedJournal.Send("a log message from a totally different process in the active journal", journal.PriInfo, nil))
|
||||
|
||||
return func(t *testing.T) logger.Logger {
|
||||
l, err := new(info)
|
||||
l, err := newJournald(info)
|
||||
assert.NilError(t, err)
|
||||
l.journalReadDir = journalDir
|
||||
sl := &syncLogger{journald: l, waiters: map[uint64]chan<- struct{}{}}
|
||||
|
||||
@@ -510,12 +510,12 @@ func logMessages(t *testing.T, l logger.Logger, messages []*logger.Message) []*l
|
||||
// existing behavior of the json-file log driver.
|
||||
func transformToExpected(m *logger.Message) *logger.Message {
|
||||
// Copy the log message again so as not to mutate the input.
|
||||
copy := copyLogMessage(m)
|
||||
logMessageCopy := copyLogMessage(m)
|
||||
if m.PLogMetaData == nil || m.PLogMetaData.Last {
|
||||
copy.Line = append(copy.Line, '\n')
|
||||
logMessageCopy.Line = append(logMessageCopy.Line, '\n')
|
||||
}
|
||||
|
||||
return copy
|
||||
return logMessageCopy
|
||||
}
|
||||
|
||||
func copyLogMessage(src *logger.Message) *logger.Message {
|
||||
|
||||
@@ -22,7 +22,7 @@ const extName = "LogDriver"
|
||||
type logPlugin interface {
|
||||
StartLogging(streamPath string, info Info) (err error)
|
||||
StopLogging(streamPath string) (err error)
|
||||
Capabilities() (cap Capability, err error)
|
||||
Capabilities() (capability Capability, err error)
|
||||
ReadLogs(info Info, config ReadConfig) (stream io.ReadCloser, err error)
|
||||
}
|
||||
|
||||
@@ -90,9 +90,9 @@ func makePluginCreator(name string, l logPlugin, scopePath func(s string) string
|
||||
logInfo: logCtx,
|
||||
}
|
||||
|
||||
cap, err := a.plugin.Capabilities()
|
||||
caps, err := a.plugin.Capabilities()
|
||||
if err == nil {
|
||||
a.capabilities = cap
|
||||
a.capabilities = caps
|
||||
}
|
||||
|
||||
stream, err := openPluginStream(a)
|
||||
@@ -107,7 +107,7 @@ func makePluginCreator(name string, l logPlugin, scopePath func(s string) string
|
||||
return nil, errors.Wrapf(err, "error creating logger")
|
||||
}
|
||||
|
||||
if cap.ReadLogs {
|
||||
if caps.ReadLogs {
|
||||
return &pluginAdapterWithRead{a}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -80,13 +80,11 @@ func (pp *logPluginProxy) Capabilities() (cap Capability, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
cap = ret.Cap
|
||||
|
||||
if ret.Err != "" {
|
||||
err = errors.New(ret.Err)
|
||||
}
|
||||
|
||||
return
|
||||
return ret.Cap, err
|
||||
}
|
||||
|
||||
type logPluginProxyReadLogsRequest struct {
|
||||
|
||||
@@ -641,7 +641,7 @@ func getMaxMountAndExistenceCheckAttempts(layer PushLayer) (maxMountAttempts, ma
|
||||
func getRepositoryMountCandidates(
|
||||
repoInfo reference.Named,
|
||||
hmacKey []byte,
|
||||
max int,
|
||||
maxCandidates int,
|
||||
v2Metadata []metadata.V2Metadata,
|
||||
) []metadata.V2Metadata {
|
||||
candidates := []metadata.V2Metadata{}
|
||||
@@ -658,9 +658,9 @@ func getRepositoryMountCandidates(
|
||||
}
|
||||
|
||||
sortV2MetadataByLikenessAndAge(repoInfo, hmacKey, candidates)
|
||||
if max >= 0 && len(candidates) > max {
|
||||
if maxCandidates >= 0 && len(candidates) > maxCandidates {
|
||||
// select the youngest metadata
|
||||
candidates = candidates[:max]
|
||||
candidates = candidates[:maxCandidates]
|
||||
}
|
||||
|
||||
return candidates
|
||||
|
||||
@@ -52,9 +52,9 @@ type DownloadOption func(*LayerDownloadManager)
|
||||
|
||||
// WithMaxDownloadAttempts configures the maximum number of download
|
||||
// attempts for a download manager.
|
||||
func WithMaxDownloadAttempts(max int) DownloadOption {
|
||||
func WithMaxDownloadAttempts(maxDownloadAttempts int) DownloadOption {
|
||||
return func(dlm *LayerDownloadManager) {
|
||||
dlm.maxDownloadAttempts = max
|
||||
dlm.maxDownloadAttempts = maxDownloadAttempts
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ func (h *Bitmap) IsSet(ordinal uint64) bool {
|
||||
}
|
||||
|
||||
// set/reset the bit
|
||||
func (h *Bitmap) set(ordinal, start, end uint64, any bool, release bool, serial bool) (uint64, error) {
|
||||
func (h *Bitmap) set(ordinal, start, end uint64, isAvailable bool, release bool, serial bool) (uint64, error) {
|
||||
var (
|
||||
bitPos uint64
|
||||
bytePos uint64
|
||||
@@ -248,7 +248,7 @@ func (h *Bitmap) set(ordinal, start, end uint64, any bool, release bool, serial
|
||||
if release {
|
||||
bytePos, bitPos = ordinalToPos(ordinal)
|
||||
} else {
|
||||
if any {
|
||||
if isAvailable {
|
||||
bytePos, bitPos, err = getAvailableFromCurrent(h.head, start, curr, end)
|
||||
ret = posToOrdinal(bytePos, bitPos)
|
||||
if err == nil {
|
||||
|
||||
@@ -15,7 +15,7 @@ type driverTester struct {
|
||||
d *driver
|
||||
}
|
||||
|
||||
func (dt *driverTester) RegisterDriver(name string, drv driverapi.Driver, cap driverapi.Capability) error {
|
||||
func (dt *driverTester) RegisterDriver(name string, drv driverapi.Driver, capability driverapi.Capability) error {
|
||||
if name != testNetworkType {
|
||||
dt.t.Fatalf("Expected driver register name to be %q. Instead got %q",
|
||||
testNetworkType, name)
|
||||
|
||||
@@ -15,7 +15,7 @@ type driverTester struct {
|
||||
d *driver
|
||||
}
|
||||
|
||||
func (dt *driverTester) RegisterDriver(name string, drv driverapi.Driver, cap driverapi.Capability) error {
|
||||
func (dt *driverTester) RegisterDriver(name string, drv driverapi.Driver, capability driverapi.Capability) error {
|
||||
if name != testNetworkType {
|
||||
dt.t.Fatalf("Expected driver register name to be %q. Instead got %q",
|
||||
testNetworkType, name)
|
||||
|
||||
@@ -20,7 +20,7 @@ func (dt *driverTester) GetPluginGetter() plugingetter.PluginGetter {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dt *driverTester) RegisterDriver(name string, drv driverapi.Driver, cap driverapi.Capability) error {
|
||||
func (dt *driverTester) RegisterDriver(name string, drv driverapi.Driver, capability driverapi.Capability) error {
|
||||
if name != testNetworkType {
|
||||
dt.t.Fatalf("Expected driver register name to be %q. Instead got %q",
|
||||
testNetworkType, name)
|
||||
|
||||
@@ -60,7 +60,7 @@ func (ir *IPAMs) RegisterIpamDriver(name string, driver ipamapi.Ipam) error {
|
||||
}
|
||||
|
||||
// IPAMWalkFunc defines the IPAM driver table walker function signature.
|
||||
type IPAMWalkFunc func(name string, driver ipamapi.Ipam, cap *ipamapi.Capability) bool
|
||||
type IPAMWalkFunc func(name string, driver ipamapi.Ipam, capability *ipamapi.Capability) bool
|
||||
|
||||
// WalkIPAMs walks the IPAM drivers registered in the registry and invokes the passed walk function and each one of them.
|
||||
func (ir *IPAMs) WalkIPAMs(ifn IPAMWalkFunc) {
|
||||
|
||||
@@ -36,7 +36,7 @@ func TestIPAMs(t *testing.T) {
|
||||
reg := getNewIPAMs(t)
|
||||
|
||||
ipams := make([]string, 0, 2)
|
||||
reg.WalkIPAMs(func(name string, driver ipamapi.Ipam, cap *ipamapi.Capability) bool {
|
||||
reg.WalkIPAMs(func(name string, driver ipamapi.Ipam, capability *ipamapi.Capability) bool {
|
||||
ipams = append(ipams, name)
|
||||
return false
|
||||
})
|
||||
|
||||
@@ -49,9 +49,9 @@ func TestNetworks(t *testing.T) {
|
||||
err := reg.RegisterDriver(mockDriverName, &md, mockDriverCaps)
|
||||
assert.NilError(t, err)
|
||||
|
||||
d, cap := reg.Driver(mockDriverName)
|
||||
assert.Check(t, d != nil)
|
||||
assert.Check(t, is.DeepEqual(cap, mockDriverCaps))
|
||||
driver, capability := reg.Driver(mockDriverName)
|
||||
assert.Check(t, driver != nil)
|
||||
assert.Check(t, is.DeepEqual(capability, mockDriverCaps))
|
||||
})
|
||||
|
||||
t.Run("WalkDrivers", func(t *testing.T) {
|
||||
|
||||
@@ -38,13 +38,13 @@ func CheckRouteOverlaps(toCheck *net.IPNet) error {
|
||||
// GenerateIfaceName returns an interface name using the passed in
|
||||
// prefix and the length of random bytes. The api ensures that the
|
||||
// there are is no interface which exists with that name.
|
||||
func GenerateIfaceName(nlh *netlink.Handle, prefix string, len int) (string, error) {
|
||||
func GenerateIfaceName(nlh *netlink.Handle, prefix string, length int) (string, error) {
|
||||
linkByName := netlink.LinkByName
|
||||
if nlh != nil {
|
||||
linkByName = nlh.LinkByName
|
||||
}
|
||||
for i := 0; i < 3; i++ {
|
||||
name, err := GenerateRandomName(prefix, len)
|
||||
name, err := GenerateRandomName(prefix, length)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ func DefaultConfig() *Config {
|
||||
// New creates a new instance of NetworkDB using the Config passed by
|
||||
// the caller.
|
||||
func New(c *Config) (*NetworkDB, error) {
|
||||
nDB := new(c)
|
||||
nDB := newNetworkDB(c)
|
||||
log.G(context.TODO()).Infof("New memberlist node - Node:%v will use memberlist nodeID:%v with config:%+v", c.Hostname, c.NodeID, c)
|
||||
if err := nDB.clusterInit(); err != nil {
|
||||
return nil, err
|
||||
@@ -261,7 +261,7 @@ func New(c *Config) (*NetworkDB, error) {
|
||||
return nDB, nil
|
||||
}
|
||||
|
||||
func new(c *Config) *NetworkDB {
|
||||
func newNetworkDB(c *Config) *NetworkDB {
|
||||
// The garbage collection logic for entries leverage the presence of the network.
|
||||
// For this reason the expiration time of the network is put slightly higher than the entry expiration so that
|
||||
// there is at least 5 extra cycle to make sure that all the entries are properly deleted before deleting the network.
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestWatch_out_of_order(t *testing.T) {
|
||||
nDB := new(DefaultConfig())
|
||||
nDB := newNetworkDB(DefaultConfig())
|
||||
nDB.networkBroadcasts = &memberlist.TransmitLimitedQueue{}
|
||||
nDB.nodeBroadcasts = &memberlist.TransmitLimitedQueue{}
|
||||
assert.Assert(t, nDB.JoinNetwork("network1"))
|
||||
@@ -93,7 +93,7 @@ func TestWatch_out_of_order(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWatch_filters(t *testing.T) {
|
||||
nDB := new(DefaultConfig())
|
||||
nDB := newNetworkDB(DefaultConfig())
|
||||
nDB.networkBroadcasts = &memberlist.TransmitLimitedQueue{}
|
||||
nDB.nodeBroadcasts = &memberlist.TransmitLimitedQueue{}
|
||||
assert.Assert(t, nDB.JoinNetwork("network1"))
|
||||
|
||||
@@ -72,7 +72,7 @@ func TestManagerWithPluginMounts(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func newTestPlugin(t *testing.T, name, cap, root string) *v2.Plugin {
|
||||
func newTestPlugin(t *testing.T, name, capability, root string) *v2.Plugin {
|
||||
id := stringid.GenerateRandomID()
|
||||
rootfs := filepath.Join(root, id)
|
||||
if err := os.MkdirAll(rootfs, 0o755); err != nil {
|
||||
@@ -81,7 +81,7 @@ func newTestPlugin(t *testing.T, name, cap, root string) *v2.Plugin {
|
||||
|
||||
p := v2.Plugin{PluginObj: types.Plugin{ID: id, Name: name}}
|
||||
p.Rootfs = rootfs
|
||||
iType := types.PluginInterfaceType{Capability: cap, Prefix: "docker", Version: "1.0"}
|
||||
iType := types.PluginInterfaceType{Capability: capability, Prefix: "docker", Version: "1.0"}
|
||||
i := types.PluginConfigInterface{Socket: "plugin.sock", Types: []types.PluginInterfaceType{iType}}
|
||||
p.PluginObj.Config.Interface = i
|
||||
p.PluginObj.ID = id
|
||||
|
||||
@@ -205,8 +205,8 @@ func (ps *Store) GetAllByCap(capability string) ([]plugingetter.CompatPlugin, er
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func pluginType(cap string) string {
|
||||
return fmt.Sprintf("docker.%s/%s", strings.ToLower(cap), defaultAPIVersion)
|
||||
func pluginType(capability string) string {
|
||||
return fmt.Sprintf("docker.%s/%s", strings.ToLower(capability), defaultAPIVersion)
|
||||
}
|
||||
|
||||
// Handle sets a callback for a given capability. It is only used by network
|
||||
@@ -233,10 +233,10 @@ func (ps *Store) Handle(capability string, callback func(string, *plugins.Client
|
||||
|
||||
// RegisterRuntimeOpt stores a list of SpecOpts for the provided capability.
|
||||
// These options are applied to the runtime spec before a plugin is started for the specified capability.
|
||||
func (ps *Store) RegisterRuntimeOpt(cap string, opts ...SpecOpt) {
|
||||
func (ps *Store) RegisterRuntimeOpt(capability string, opts ...SpecOpt) {
|
||||
ps.Lock()
|
||||
defer ps.Unlock()
|
||||
typ := pluginType(cap)
|
||||
typ := pluginType(capability)
|
||||
ps.specOpts[typ] = append(ps.specOpts[typ], opts...)
|
||||
}
|
||||
|
||||
|
||||
@@ -81,15 +81,15 @@ func (a *volumeDriverAdapter) Get(name string) (volume.Volume, error) {
|
||||
}
|
||||
|
||||
func (a *volumeDriverAdapter) Scope() string {
|
||||
cap := a.getCapabilities()
|
||||
return cap.Scope
|
||||
capabilities := a.getCapabilities()
|
||||
return capabilities.Scope
|
||||
}
|
||||
|
||||
func (a *volumeDriverAdapter) getCapabilities() volume.Capability {
|
||||
if a.capabilities != nil {
|
||||
return *a.capabilities
|
||||
}
|
||||
cap, err := a.proxy.Capabilities()
|
||||
capabilities, err := a.proxy.Capabilities()
|
||||
if err != nil {
|
||||
// `GetCapabilities` is a not a required endpoint.
|
||||
// On error assume it's a local-only driver
|
||||
@@ -98,18 +98,18 @@ func (a *volumeDriverAdapter) getCapabilities() volume.Capability {
|
||||
}
|
||||
|
||||
// don't spam the warn log below just because the plugin didn't provide a scope
|
||||
if len(cap.Scope) == 0 {
|
||||
cap.Scope = volume.LocalScope
|
||||
if len(capabilities.Scope) == 0 {
|
||||
capabilities.Scope = volume.LocalScope
|
||||
}
|
||||
|
||||
cap.Scope = strings.ToLower(cap.Scope)
|
||||
if cap.Scope != volume.LocalScope && cap.Scope != volume.GlobalScope {
|
||||
capabilities.Scope = strings.ToLower(capabilities.Scope)
|
||||
if capabilities.Scope != volume.LocalScope && capabilities.Scope != volume.GlobalScope {
|
||||
log.G(context.TODO()).WithField("driver", a.Name()).WithField("scope", a.Scope).Warn("Volume driver returned an invalid scope")
|
||||
cap.Scope = volume.LocalScope
|
||||
capabilities.Scope = volume.LocalScope
|
||||
}
|
||||
|
||||
a.capabilities = &cap
|
||||
return cap
|
||||
a.capabilities = &capabilities
|
||||
return capabilities
|
||||
}
|
||||
|
||||
type volumeAdapter struct {
|
||||
|
||||
Reference in New Issue
Block a user