libnetwork: rename vars that collided with builtins

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-08-16 11:28:38 +02:00
parent e8f0f5a4ce
commit e2f9d6c4c3
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 8 additions and 8 deletions

View file

@ -374,7 +374,7 @@ func (c *Controller) BuiltinDrivers() []string {
// BuiltinIPAMDrivers returns the list of builtin ipam drivers.
func (c *Controller) BuiltinIPAMDrivers() []string {
drivers := []string{}
c.ipamRegistry.WalkIPAMs(func(name string, driver ipamapi.Ipam, cap *ipamapi.Capability) bool {
c.ipamRegistry.WalkIPAMs(func(name string, driver ipamapi.Ipam, _ *ipamapi.Capability) bool {
if driver.IsBuiltIn() {
drivers = append(drivers, name)
}
@ -392,14 +392,14 @@ func (c *Controller) processNodeDiscovery(nodes []net.IP, add bool) {
})
}
func (c *Controller) pushNodeDiscovery(d discoverapi.Discover, cap driverapi.Capability, nodes []net.IP, add bool) {
func (c *Controller) pushNodeDiscovery(d discoverapi.Discover, capability driverapi.Capability, nodes []net.IP, add bool) {
var self net.IP
// try swarm-mode config
if agent := c.getAgent(); agent != nil {
self = net.ParseIP(agent.advertiseAddr)
}
if d == nil || cap.ConnectivityScope != scope.Global || nodes == nil {
if d == nil || capability.ConnectivityScope != scope.Global || nodes == nil {
return
}
@ -1095,7 +1095,7 @@ func (c *Controller) loadIPAMDriver(name string) error {
}
func (c *Controller) getIPAMDriver(name string) (ipamapi.Ipam, *ipamapi.Capability, error) {
id, cap := c.ipamRegistry.IPAM(name)
id, caps := c.ipamRegistry.IPAM(name)
if id == nil {
// Might be a plugin name. Try loading it
if err := c.loadIPAMDriver(name); err != nil {
@ -1103,13 +1103,13 @@ func (c *Controller) getIPAMDriver(name string) (ipamapi.Ipam, *ipamapi.Capabili
}
// Now that we resolved the plugin, try again looking up the registry
id, cap = c.ipamRegistry.IPAM(name)
id, caps = c.ipamRegistry.IPAM(name)
if id == nil {
return nil, nil, types.BadRequestErrorf("invalid ipam driver: %q", name)
}
}
return id, cap, nil
return id, caps, nil
}
// Stop stops the network controller.

View file

@ -27,9 +27,9 @@ func TestIPAMs(t *testing.T) {
t.Run("IPAM", func(t *testing.T) {
reg := getNewIPAMs(t)
i, cap := reg.IPAM("default")
i, caps := reg.IPAM("default")
assert.Check(t, i != nil)
assert.Check(t, cap != nil)
assert.Check(t, caps != nil)
})
t.Run("WalkIPAMs", func(t *testing.T) {