mirror of
https://github.com/containers/podman.git
synced 2025-07-03 09:17:15 +08:00
Change Inherit to use a pointer to a container
This fixes a lint issue, but I'm keeping it in its own commit so it can be reverted independently if necessary; I don't know what side effects this may have. I don't *think* there are any issues, but I'm not sure why it wasn't a pointer in the first place, so there may have been a reason. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
@ -113,7 +113,10 @@ func removePods(namesOrIDs []string, rmOptions entities.PodRmOptions, printIDs b
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
setExitCode(err)
|
setExitCode(err)
|
||||||
return append(errs, err)
|
errs = append(errs, err)
|
||||||
|
if !strings.Contains(err.Error(), define.ErrRemovingCtrs.Error()) {
|
||||||
|
return errs
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// in the cli, first we print out all the successful attempts
|
// in the cli, first we print out all the successful attempts
|
||||||
|
@ -211,4 +211,8 @@ var (
|
|||||||
// ErrConmonVersionFormat is used when the expected version format of conmon
|
// ErrConmonVersionFormat is used when the expected version format of conmon
|
||||||
// has changed.
|
// has changed.
|
||||||
ErrConmonVersionFormat = "conmon version changed format"
|
ErrConmonVersionFormat = "conmon version changed format"
|
||||||
|
|
||||||
|
// ErrRemovingCtrs indicates that there was an error removing all
|
||||||
|
// containers from a pod.
|
||||||
|
ErrRemovingCtrs = errors.New("removing pod containers")
|
||||||
)
|
)
|
||||||
|
@ -248,7 +248,7 @@ func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(ctrErrors) > 0 {
|
if len(ctrErrors) > 0 {
|
||||||
return removedCtrs, fmt.Errorf("not all containers could be removed from pod %s: %w", p.ID(), define.ErrCtrExists)
|
return removedCtrs, fmt.Errorf("not all containers could be removed from pod %s: %w", p.ID(), define.ErrRemovingCtrs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener
|
|||||||
compatibleOptions := &libpod.InfraInherit{}
|
compatibleOptions := &libpod.InfraInherit{}
|
||||||
var infraSpec *specs.Spec
|
var infraSpec *specs.Spec
|
||||||
if infra != nil {
|
if infra != nil {
|
||||||
options, infraSpec, compatibleOptions, err = Inherit(*infra, s, rt)
|
options, infraSpec, compatibleOptions, err = Inherit(infra, s, rt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
@ -636,7 +636,7 @@ func createContainerOptions(rt *libpod.Runtime, s *specgen.SpecGenerator, pod *l
|
|||||||
return options, nil
|
return options, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Inherit(infra libpod.Container, s *specgen.SpecGenerator, rt *libpod.Runtime) (opts []libpod.CtrCreateOption, infraS *specs.Spec, compat *libpod.InfraInherit, err error) {
|
func Inherit(infra *libpod.Container, s *specgen.SpecGenerator, rt *libpod.Runtime) (opts []libpod.CtrCreateOption, infraS *specs.Spec, compat *libpod.InfraInherit, err error) {
|
||||||
inheritSpec := &specgen.SpecGenerator{}
|
inheritSpec := &specgen.SpecGenerator{}
|
||||||
_, compatibleOptions, err := ConfigToSpec(rt, inheritSpec, infra.ID())
|
_, compatibleOptions, err := ConfigToSpec(rt, inheritSpec, infra.ID())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user