remove unneeded return value from c.Networks()

We do not need to return a extra bool.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2021-12-07 20:43:04 +01:00
parent 5490be67b3
commit 4e8ad039ce
6 changed files with 10 additions and 10 deletions

View File

@ -1166,19 +1166,19 @@ func (c *Container) Secrets() []*ContainerSecret {
// is joining the default CNI network - the network name will be included in the
// returned array of network names, but the container did not explicitly join
// this network.
func (c *Container) Networks() ([]string, bool, error) {
func (c *Container) Networks() ([]string, error) {
if !c.batched {
c.lock.Lock()
defer c.lock.Unlock()
if err := c.syncContainer(); err != nil {
return nil, false, err
return nil, err
}
}
networks, err := c.networks()
if err != nil {
return nil, false, err
return nil, err
}
names := make([]string, 0, len(networks))
@ -1187,7 +1187,7 @@ func (c *Container) Networks() ([]string, bool, error) {
names = append(names, name)
}
return names, false, nil
return names, nil
}
// NetworkMode gets the configured network mode for the container.

View File

@ -241,7 +241,7 @@ func GenerateContainerFilterFuncs(filter string, filterValues []string, r *libpo
return false
}
networks, _, err := c.Networks()
networks, err := c.Networks()
// if err or no networks, quick out
if err != nil || len(networks) == 0 {
return false

View File

@ -134,7 +134,7 @@ func GeneratePodFilterFunc(filter string, filterValues []string) (
if err != nil {
return false
}
networks, _, err := infra.Networks()
networks, err := infra.Networks()
// if err or no networks, quick out
if err != nil || len(networks) == 0 {
return false

View File

@ -71,7 +71,7 @@ func (ic *ContainerEngine) NetworkRm(ctx context.Context, namesOrIds []string, o
}
// We need to iterate containers looking to see if they belong to the given network
for _, c := range containers {
networks, _, err := c.Networks()
networks, err := c.Networks()
// if container vanished or network does not exist, go to next container
if errors.Is(err, define.ErrNoSuchNetwork) || errors.Is(err, define.ErrNoSuchCtr) {
continue
@ -152,7 +152,7 @@ func (ic *ContainerEngine) NetworkPrune(ctx context.Context, options entities.Ne
// containers want
networksToKeep := make(map[string]bool)
for _, c := range cons {
nets, _, err := c.Networks()
nets, err := c.Networks()
if err != nil {
return nil, err
}

View File

@ -376,7 +376,7 @@ func (ic *ContainerEngine) PodPs(ctx context.Context, options entities.PodPSOpti
if err != nil {
return nil, err
}
networks, _, err = infra.Networks()
networks, err = infra.Networks()
if err != nil {
return nil, err
}

View File

@ -207,7 +207,7 @@ func ListContainerBatch(rt *libpod.Runtime, ctr *libpod.Container, opts entities
return entities.ListContainer{}, err
}
networks, _, err := ctr.Networks()
networks, err := ctr.Networks()
if err != nil {
return entities.ListContainer{}, err
}