mirror of
https://github.com/containers/podman.git
synced 2025-05-20 08:36:23 +08:00
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:
@ -1166,19 +1166,19 @@ func (c *Container) Secrets() []*ContainerSecret {
|
|||||||
// is joining the default CNI network - the network name will be included in the
|
// 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
|
// returned array of network names, but the container did not explicitly join
|
||||||
// this network.
|
// this network.
|
||||||
func (c *Container) Networks() ([]string, bool, error) {
|
func (c *Container) Networks() ([]string, error) {
|
||||||
if !c.batched {
|
if !c.batched {
|
||||||
c.lock.Lock()
|
c.lock.Lock()
|
||||||
defer c.lock.Unlock()
|
defer c.lock.Unlock()
|
||||||
|
|
||||||
if err := c.syncContainer(); err != nil {
|
if err := c.syncContainer(); err != nil {
|
||||||
return nil, false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
networks, err := c.networks()
|
networks, err := c.networks()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
names := make([]string, 0, len(networks))
|
names := make([]string, 0, len(networks))
|
||||||
@ -1187,7 +1187,7 @@ func (c *Container) Networks() ([]string, bool, error) {
|
|||||||
names = append(names, name)
|
names = append(names, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
return names, false, nil
|
return names, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkMode gets the configured network mode for the container.
|
// NetworkMode gets the configured network mode for the container.
|
||||||
|
@ -241,7 +241,7 @@ func GenerateContainerFilterFuncs(filter string, filterValues []string, r *libpo
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
networks, _, err := c.Networks()
|
networks, err := c.Networks()
|
||||||
// if err or no networks, quick out
|
// if err or no networks, quick out
|
||||||
if err != nil || len(networks) == 0 {
|
if err != nil || len(networks) == 0 {
|
||||||
return false
|
return false
|
||||||
|
@ -134,7 +134,7 @@ func GeneratePodFilterFunc(filter string, filterValues []string) (
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
networks, _, err := infra.Networks()
|
networks, err := infra.Networks()
|
||||||
// if err or no networks, quick out
|
// if err or no networks, quick out
|
||||||
if err != nil || len(networks) == 0 {
|
if err != nil || len(networks) == 0 {
|
||||||
return false
|
return false
|
||||||
|
@ -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
|
// We need to iterate containers looking to see if they belong to the given network
|
||||||
for _, c := range containers {
|
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 container vanished or network does not exist, go to next container
|
||||||
if errors.Is(err, define.ErrNoSuchNetwork) || errors.Is(err, define.ErrNoSuchCtr) {
|
if errors.Is(err, define.ErrNoSuchNetwork) || errors.Is(err, define.ErrNoSuchCtr) {
|
||||||
continue
|
continue
|
||||||
@ -152,7 +152,7 @@ func (ic *ContainerEngine) NetworkPrune(ctx context.Context, options entities.Ne
|
|||||||
// containers want
|
// containers want
|
||||||
networksToKeep := make(map[string]bool)
|
networksToKeep := make(map[string]bool)
|
||||||
for _, c := range cons {
|
for _, c := range cons {
|
||||||
nets, _, err := c.Networks()
|
nets, err := c.Networks()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ func (ic *ContainerEngine) PodPs(ctx context.Context, options entities.PodPSOpti
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
networks, _, err = infra.Networks()
|
networks, err = infra.Networks()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ func ListContainerBatch(rt *libpod.Runtime, ctr *libpod.Container, opts entities
|
|||||||
return entities.ListContainer{}, err
|
return entities.ListContainer{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
networks, _, err := ctr.Networks()
|
networks, err := ctr.Networks()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return entities.ListContainer{}, err
|
return entities.ListContainer{}, err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user