diff options
Diffstat (limited to 'pkg/domain')
60 files changed, 295 insertions, 257 deletions
diff --git a/pkg/domain/entities/container_ps.go b/pkg/domain/entities/container_ps.go index 6709ca48a..572d6b9e9 100644 --- a/pkg/domain/entities/container_ps.go +++ b/pkg/domain/entities/container_ps.go @@ -5,7 +5,7 @@ import ( "strings" "time" - "github.com/containers/podman/v2/pkg/ps/define" + "github.com/containers/podman/v3/pkg/ps/define" "github.com/cri-o/ocicni/pkg/ocicni" "github.com/pkg/errors" ) diff --git a/pkg/domain/entities/containers.go b/pkg/domain/entities/containers.go index 2d50d6826..ac965834a 100644 --- a/pkg/domain/entities/containers.go +++ b/pkg/domain/entities/containers.go @@ -7,9 +7,9 @@ import ( "time" "github.com/containers/image/v5/types" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/copy" - "github.com/containers/podman/v2/pkg/specgen" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/copy" + "github.com/containers/podman/v3/pkg/specgen" "github.com/cri-o/ocicni/pkg/ocicni" ) @@ -88,8 +88,9 @@ type StopOptions struct { } type StopReport struct { - Err error - Id string //nolint + Err error + Id string //nolint + RawInput string } type TopOptions struct { @@ -109,8 +110,9 @@ type KillOptions struct { } type KillReport struct { - Err error - Id string //nolint + Err error + Id string //nolint + RawInput string } type RestartOptions struct { diff --git a/pkg/domain/entities/engine_container.go b/pkg/domain/entities/engine_container.go index d43b422a3..bcab617af 100644 --- a/pkg/domain/entities/engine_container.go +++ b/pkg/domain/entities/engine_container.go @@ -5,9 +5,9 @@ import ( "io" "github.com/containers/common/pkg/config" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/domain/entities/reports" - "github.com/containers/podman/v2/pkg/specgen" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/domain/entities/reports" + "github.com/containers/podman/v3/pkg/specgen" "github.com/spf13/cobra" ) @@ -91,7 +91,7 @@ type ContainerEngine interface { Unshare(ctx context.Context, args []string) error Version(ctx context.Context) (*SystemVersionReport, error) VolumeCreate(ctx context.Context, opts VolumeCreateOptions) (*IDOrNameResponse, error) - VolumeExists(ctx context.Context, namesOrId string) (*BoolReport, error) + VolumeExists(ctx context.Context, namesOrID string) (*BoolReport, error) VolumeInspect(ctx context.Context, namesOrIds []string, opts InspectOptions) ([]*VolumeInspectReport, []error, error) VolumeList(ctx context.Context, opts VolumeListOptions) ([]*VolumeListReport, error) VolumePrune(ctx context.Context, options VolumePruneOptions) ([]*reports.PruneReport, error) diff --git a/pkg/domain/entities/engine_image.go b/pkg/domain/entities/engine_image.go index ee611502f..d841ecd6e 100644 --- a/pkg/domain/entities/engine_image.go +++ b/pkg/domain/entities/engine_image.go @@ -4,7 +4,7 @@ import ( "context" "github.com/containers/common/pkg/config" - "github.com/containers/podman/v2/pkg/domain/entities/reports" + "github.com/containers/podman/v3/pkg/domain/entities/reports" ) type ImageEngine interface { diff --git a/pkg/domain/entities/events.go b/pkg/domain/entities/events.go index f4f3b705f..930ca53ae 100644 --- a/pkg/domain/entities/events.go +++ b/pkg/domain/entities/events.go @@ -4,7 +4,7 @@ import ( "strconv" "time" - libpodEvents "github.com/containers/podman/v2/libpod/events" + libpodEvents "github.com/containers/podman/v3/libpod/events" dockerEvents "github.com/docker/docker/api/types/events" ) diff --git a/pkg/domain/entities/generate.go b/pkg/domain/entities/generate.go index 4a0d7537e..3ec713edf 100644 --- a/pkg/domain/entities/generate.go +++ b/pkg/domain/entities/generate.go @@ -18,6 +18,8 @@ type GenerateSystemdOptions struct { PodPrefix string // Separator - systemd unit name separator between name/id and prefix Separator string + // NoHeader - skip header generation + NoHeader bool } // GenerateSystemdReport diff --git a/pkg/domain/entities/images.go b/pkg/domain/entities/images.go index ef40d5490..19109f873 100644 --- a/pkg/domain/entities/images.go +++ b/pkg/domain/entities/images.go @@ -6,8 +6,8 @@ import ( "github.com/containers/common/pkg/config" "github.com/containers/image/v5/manifest" "github.com/containers/image/v5/types" - "github.com/containers/podman/v2/pkg/inspect" - "github.com/containers/podman/v2/pkg/trust" + "github.com/containers/podman/v3/pkg/inspect" + "github.com/containers/podman/v3/pkg/trust" docker "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/opencontainers/go-digest" diff --git a/pkg/domain/entities/network.go b/pkg/domain/entities/network.go index 1859f920e..f66a7f575 100644 --- a/pkg/domain/entities/network.go +++ b/pkg/domain/entities/network.go @@ -31,6 +31,7 @@ type NetworkReloadOptions struct { // NetworkReloadReport describes the results of reloading a container network. type NetworkReloadReport struct { + // nolint:stylecheck,golint Id string Err error } diff --git a/pkg/domain/entities/pods.go b/pkg/domain/entities/pods.go index 32900d536..88055454f 100644 --- a/pkg/domain/entities/pods.go +++ b/pkg/domain/entities/pods.go @@ -5,8 +5,8 @@ import ( "strings" "time" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/specgen" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/specgen" ) type PodKillOptions struct { diff --git a/pkg/domain/entities/secrets.go b/pkg/domain/entities/secrets.go index 3cad4c099..3481cbe05 100644 --- a/pkg/domain/entities/secrets.go +++ b/pkg/domain/entities/secrets.go @@ -3,7 +3,7 @@ package entities import ( "time" - "github.com/containers/podman/v2/pkg/errorhandling" + "github.com/containers/podman/v3/pkg/errorhandling" ) type SecretCreateReport struct { diff --git a/pkg/domain/entities/system.go b/pkg/domain/entities/system.go index 99fa947f0..a1cfb4481 100644 --- a/pkg/domain/entities/system.go +++ b/pkg/domain/entities/system.go @@ -3,8 +3,8 @@ package entities import ( "time" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/domain/entities/reports" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/domain/entities/reports" "github.com/docker/docker/api/types" "github.com/spf13/cobra" ) diff --git a/pkg/domain/entities/types.go b/pkg/domain/entities/types.go index e5473dc62..9efc64c93 100644 --- a/pkg/domain/entities/types.go +++ b/pkg/domain/entities/types.go @@ -4,8 +4,8 @@ import ( "net" "github.com/containers/buildah/imagebuildah" - "github.com/containers/podman/v2/libpod/events" - "github.com/containers/podman/v2/pkg/specgen" + "github.com/containers/podman/v3/libpod/events" + "github.com/containers/podman/v3/pkg/specgen" "github.com/containers/storage/pkg/archive" ) diff --git a/pkg/domain/entities/volumes.go b/pkg/domain/entities/volumes.go index c826ee389..beb2a75ac 100644 --- a/pkg/domain/entities/volumes.go +++ b/pkg/domain/entities/volumes.go @@ -3,7 +3,7 @@ package entities import ( "net/url" - "github.com/containers/podman/v2/libpod/define" + "github.com/containers/podman/v3/libpod/define" docker_api_types "github.com/docker/docker/api/types" docker_api_types_volume "github.com/docker/docker/api/types/volume" ) diff --git a/pkg/domain/filters/containers.go b/pkg/domain/filters/containers.go index 1de5aca91..6f4b4e8a0 100644 --- a/pkg/domain/filters/containers.go +++ b/pkg/domain/filters/containers.go @@ -5,11 +5,11 @@ import ( "strings" "time" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/libpod/network" - "github.com/containers/podman/v2/pkg/timetype" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/libpod/network" + "github.com/containers/podman/v3/pkg/timetype" + "github.com/containers/podman/v3/pkg/util" "github.com/pkg/errors" ) diff --git a/pkg/domain/filters/pods.go b/pkg/domain/filters/pods.go index ce7028d2a..53d10213a 100644 --- a/pkg/domain/filters/pods.go +++ b/pkg/domain/filters/pods.go @@ -4,10 +4,10 @@ import ( "strconv" "strings" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/libpod/network" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/libpod/network" + "github.com/containers/podman/v3/pkg/util" "github.com/pkg/errors" ) diff --git a/pkg/domain/filters/volumes.go b/pkg/domain/filters/volumes.go index 7890459f5..bc1756cf5 100644 --- a/pkg/domain/filters/volumes.go +++ b/pkg/domain/filters/volumes.go @@ -4,7 +4,7 @@ import ( "net/url" "strings" - "github.com/containers/podman/v2/libpod" + "github.com/containers/podman/v3/libpod" "github.com/pkg/errors" ) diff --git a/pkg/domain/infra/abi/archive.go b/pkg/domain/infra/abi/archive.go index c64dfb02a..528771ee7 100644 --- a/pkg/domain/infra/abi/archive.go +++ b/pkg/domain/infra/abi/archive.go @@ -3,13 +3,14 @@ package abi import ( "context" "io" + "path/filepath" "strings" buildahCopiah "github.com/containers/buildah/copier" "github.com/containers/buildah/pkg/chrootuser" "github.com/containers/buildah/util" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/pkg/domain/entities" "github.com/containers/storage" "github.com/containers/storage/pkg/archive" "github.com/containers/storage/pkg/idtools" @@ -93,7 +94,7 @@ func (ic *ContainerEngine) ContainerCopyToArchive(ctx context.Context, nameOrID containerPath = "/." } - _, resolvedRoot, resolvedContainerPath, err := ic.containerStat(container, containerMountPoint, containerPath) + statInfo, resolvedRoot, resolvedContainerPath, err := ic.containerStat(container, containerMountPoint, containerPath) if err != nil { unmount() return nil, err @@ -110,8 +111,8 @@ func (ic *ContainerEngine) ContainerCopyToArchive(ctx context.Context, nameOrID return func() error { defer container.Unmount(false) getOptions := buildahCopiah.GetOptions{ - // Unless the specified path ends with ".", we want to copy the base directory. - KeepDirectoryNames: !strings.HasSuffix(resolvedContainerPath, "."), + // Unless the specified points to ".", we want to copy the base directory. + KeepDirectoryNames: statInfo.IsDir && filepath.Base(containerPath) != ".", UIDMap: idMappings.UIDMap, GIDMap: idMappings.GIDMap, ChownDirs: idPair, diff --git a/pkg/domain/infra/abi/auto-update.go b/pkg/domain/infra/abi/auto-update.go index e8e2fa185..c9d7f2130 100644 --- a/pkg/domain/infra/abi/auto-update.go +++ b/pkg/domain/infra/abi/auto-update.go @@ -3,8 +3,8 @@ package abi import ( "context" - "github.com/containers/podman/v2/pkg/autoupdate" - "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/autoupdate" + "github.com/containers/podman/v3/pkg/domain/entities" ) func (ic *ContainerEngine) AutoUpdate(ctx context.Context, options entities.AutoUpdateOptions) (*entities.AutoUpdateReport, []error) { diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index 7a672d863..4790bd58c 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -12,24 +12,24 @@ import ( "github.com/containers/buildah" "github.com/containers/common/pkg/config" "github.com/containers/image/v5/manifest" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/libpod/events" - "github.com/containers/podman/v2/libpod/image" - "github.com/containers/podman/v2/libpod/logs" - "github.com/containers/podman/v2/pkg/cgroups" - "github.com/containers/podman/v2/pkg/checkpoint" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/domain/entities/reports" - dfilters "github.com/containers/podman/v2/pkg/domain/filters" - "github.com/containers/podman/v2/pkg/domain/infra/abi/terminal" - parallelctr "github.com/containers/podman/v2/pkg/parallel/ctr" - "github.com/containers/podman/v2/pkg/ps" - "github.com/containers/podman/v2/pkg/rootless" - "github.com/containers/podman/v2/pkg/signal" - "github.com/containers/podman/v2/pkg/specgen" - "github.com/containers/podman/v2/pkg/specgen/generate" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/libpod/events" + "github.com/containers/podman/v3/libpod/image" + "github.com/containers/podman/v3/libpod/logs" + "github.com/containers/podman/v3/pkg/cgroups" + "github.com/containers/podman/v3/pkg/checkpoint" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/domain/entities/reports" + dfilters "github.com/containers/podman/v3/pkg/domain/filters" + "github.com/containers/podman/v3/pkg/domain/infra/abi/terminal" + parallelctr "github.com/containers/podman/v3/pkg/parallel/ctr" + "github.com/containers/podman/v3/pkg/ps" + "github.com/containers/podman/v3/pkg/rootless" + "github.com/containers/podman/v3/pkg/signal" + "github.com/containers/podman/v3/pkg/specgen" + "github.com/containers/podman/v3/pkg/specgen/generate" + "github.com/containers/podman/v3/pkg/util" "github.com/containers/storage" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -138,10 +138,16 @@ func (ic *ContainerEngine) ContainerUnpause(ctx context.Context, namesOrIds []st } func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []string, options entities.StopOptions) ([]*entities.StopReport, error) { names := namesOrIds - ctrs, err := getContainersByContext(options.All, options.Latest, names, ic.Libpod) + ctrs, rawInputs, err := getContainersAndInputByContext(options.All, options.Latest, names, ic.Libpod) if err != nil && !(options.Ignore && errors.Cause(err) == define.ErrNoSuchCtr) { return nil, err } + ctrMap := map[string]string{} + if len(rawInputs) == len(ctrs) { + for i := range ctrs { + ctrMap[ctrs[i].ID()] = rawInputs[i] + } + } errMap, err := parallelctr.ContainerOp(ctx, ctrs, func(c *libpod.Container) error { var err error if options.Timeout != nil { @@ -174,6 +180,11 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin for ctr, err := range errMap { report := new(entities.StopReport) report.Id = ctr.ID() + if options.All { + report.RawInput = ctr.ID() + } else { + report.RawInput = ctrMap[ctr.ID()] + } report.Err = err reports = append(reports, report) } @@ -197,15 +208,22 @@ func (ic *ContainerEngine) ContainerKill(ctx context.Context, namesOrIds []strin if err != nil { return nil, err } - ctrs, err := getContainersByContext(options.All, options.Latest, namesOrIds, ic.Libpod) + ctrs, rawInputs, err := getContainersAndInputByContext(options.All, options.Latest, namesOrIds, ic.Libpod) if err != nil { return nil, err } + ctrMap := map[string]string{} + if len(rawInputs) == len(ctrs) { + for i := range ctrs { + ctrMap[ctrs[i].ID()] = rawInputs[i] + } + } reports := make([]*entities.KillReport, 0, len(ctrs)) for _, con := range ctrs { reports = append(reports, &entities.KillReport{ - Id: con.ID(), - Err: con.Kill(uint(sig)), + Id: con.ID(), + Err: con.Kill(uint(sig)), + RawInput: ctrMap[con.ID()], }) } return reports, nil @@ -301,12 +319,18 @@ func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string, errMap, err := parallelctr.ContainerOp(ctx, ctrs, func(c *libpod.Container) error { err := ic.Libpod.RemoveContainer(ctx, c, options.Force, options.Volumes) - if err != nil { - if options.Ignore && errors.Cause(err) == define.ErrNoSuchCtr { + if err == nil { + return nil + } + logrus.Debugf("Failed to remove container %s: %s", c.ID(), err.Error()) + switch errors.Cause(err) { + case define.ErrNoSuchCtr: + if options.Ignore { logrus.Debugf("Ignoring error (--allow-missing): %v", err) return nil } - logrus.Debugf("Failed to remove container %s: %s", c.ID(), err.Error()) + case define.ErrCtrRemoved: + return nil } return err }) diff --git a/pkg/domain/infra/abi/containers_runlabel.go b/pkg/domain/infra/abi/containers_runlabel.go index 41fdf8f34..8de383926 100644 --- a/pkg/domain/infra/abi/containers_runlabel.go +++ b/pkg/domain/infra/abi/containers_runlabel.go @@ -7,11 +7,11 @@ import ( "path/filepath" "strings" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/libpod/image" - "github.com/containers/podman/v2/pkg/domain/entities" - envLib "github.com/containers/podman/v2/pkg/env" - "github.com/containers/podman/v2/utils" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/libpod/image" + "github.com/containers/podman/v3/pkg/domain/entities" + envLib "github.com/containers/podman/v3/pkg/env" + "github.com/containers/podman/v3/utils" "github.com/google/shlex" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/pkg/domain/infra/abi/containers_stat.go b/pkg/domain/infra/abi/containers_stat.go index f3d0799a0..1baeb9178 100644 --- a/pkg/domain/infra/abi/containers_stat.go +++ b/pkg/domain/infra/abi/containers_stat.go @@ -7,9 +7,9 @@ import ( "strings" buildahCopiah "github.com/containers/buildah/copier" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/pkg/copy" - "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/pkg/copy" + "github.com/containers/podman/v3/pkg/domain/entities" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -35,7 +35,7 @@ func (ic *ContainerEngine) containerStat(container *libpod.Container, containerM // ENOENT let's the API handlers return the correct status code // which is crucial for the remote client. if os.IsNotExist(err) || strings.Contains(statInfoErr.Error(), "o such file or directory") { - statInfoErr = copy.ENOENT + statInfoErr = copy.ErrENOENT } // If statInfo is nil, there's nothing we can do anymore. A // non-nil statInfo may indicate a symlink where we must have @@ -129,7 +129,7 @@ func secureStat(root string, path string) (*buildahCopiah.StatForItem, error) { stat, exists := globStats[0].Results[glob] // only one glob passed, so that's okay if !exists { - return nil, copy.ENOENT + return nil, copy.ErrENOENT } var statErr error diff --git a/pkg/domain/infra/abi/events.go b/pkg/domain/infra/abi/events.go index fa57543bf..d7e2566e3 100644 --- a/pkg/domain/infra/abi/events.go +++ b/pkg/domain/infra/abi/events.go @@ -3,8 +3,8 @@ package abi import ( "context" - "github.com/containers/podman/v2/libpod/events" - "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v3/libpod/events" + "github.com/containers/podman/v3/pkg/domain/entities" ) func (ic *ContainerEngine) Events(ctx context.Context, opts entities.EventsOptions) error { diff --git a/pkg/domain/infra/abi/generate.go b/pkg/domain/infra/abi/generate.go index 79f55e2bd..161becbfa 100644 --- a/pkg/domain/infra/abi/generate.go +++ b/pkg/domain/infra/abi/generate.go @@ -5,10 +5,10 @@ import ( "context" "fmt" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/systemd/generate" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/systemd/generate" "github.com/ghodss/yaml" "github.com/pkg/errors" k8sAPI "k8s.io/api/core/v1" diff --git a/pkg/domain/infra/abi/healthcheck.go b/pkg/domain/infra/abi/healthcheck.go index 49b709f39..92ccd19af 100644 --- a/pkg/domain/infra/abi/healthcheck.go +++ b/pkg/domain/infra/abi/healthcheck.go @@ -3,8 +3,8 @@ package abi import ( "context" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/domain/entities" ) func (ic *ContainerEngine) HealthCheckRun(ctx context.Context, nameOrID string, options entities.HealthCheckOptions) (*define.HealthCheckResults, error) { diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go index f2d0f2c39..562653403 100644 --- a/pkg/domain/infra/abi/images.go +++ b/pkg/domain/infra/abi/images.go @@ -20,13 +20,13 @@ import ( "github.com/containers/image/v5/transports" "github.com/containers/image/v5/transports/alltransports" "github.com/containers/image/v5/types" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/libpod/image" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/domain/entities/reports" - domainUtils "github.com/containers/podman/v2/pkg/domain/utils" - "github.com/containers/podman/v2/pkg/rootless" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/libpod/image" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/domain/entities/reports" + domainUtils "github.com/containers/podman/v3/pkg/domain/utils" + "github.com/containers/podman/v3/pkg/rootless" + "github.com/containers/podman/v3/pkg/util" "github.com/containers/storage" dockerRef "github.com/docker/distribution/reference" "github.com/opencontainers/go-digest" @@ -40,10 +40,9 @@ func (ir *ImageEngine) Exists(_ context.Context, nameOrID string) (*entities.Boo if err != nil { if errors.Cause(err) == define.ErrMultipleImages { return &entities.BoolReport{Value: true}, nil - } else { - if errors.Cause(err) != define.ErrNoSuchImage { - return nil, err - } + } + if errors.Cause(err) != define.ErrNoSuchImage { + return nil, err } } return &entities.BoolReport{Value: err == nil}, nil @@ -248,7 +247,7 @@ func pull(ctx context.Context, runtime *image.Runtime, rawImage string, options } if !options.AllTags { - newImage, err := runtime.New(ctx, rawImage, options.SignaturePolicy, options.Authfile, writer, &dockerRegistryOptions, image.SigningOptions{}, label, options.PullPolicy) + newImage, err := runtime.New(ctx, rawImage, options.SignaturePolicy, options.Authfile, writer, &dockerRegistryOptions, image.SigningOptions{}, label, options.PullPolicy, nil) if err != nil { return nil, err } @@ -270,7 +269,6 @@ func pull(ctx context.Context, runtime *image.Runtime, rawImage string, options } if _, isTagged := namedRef.(reference.Tagged); isTagged { return nil, errors.New("--all-tags requires a reference without a tag") - } systemContext := image.GetSystemContext("", options.Authfile, false) @@ -282,7 +280,7 @@ func pull(ctx context.Context, runtime *image.Runtime, rawImage string, options foundIDs := []string{} for _, tag := range tags { name := rawImage + ":" + tag - newImage, err := runtime.New(ctx, name, options.SignaturePolicy, options.Authfile, writer, &dockerRegistryOptions, image.SigningOptions{}, nil, util.PullImageAlways) + newImage, err := runtime.New(ctx, name, options.SignaturePolicy, options.Authfile, writer, &dockerRegistryOptions, image.SigningOptions{}, nil, util.PullImageAlways, nil) if err != nil { logrus.Errorf("error pulling image %q", name) continue @@ -503,7 +501,6 @@ func (ir *ImageEngine) Config(_ context.Context) (*config.Config, error) { } func (ir *ImageEngine) Build(ctx context.Context, containerFiles []string, opts entities.BuildOptions) (*entities.BuildReport, error) { - id, _, err := ir.Libpod.Build(ctx, opts.BuildOptions, containerFiles...) if err != nil { return nil, err diff --git a/pkg/domain/infra/abi/images_list.go b/pkg/domain/infra/abi/images_list.go index 2d3b9f36a..3b8aabeb7 100644 --- a/pkg/domain/infra/abi/images_list.go +++ b/pkg/domain/infra/abi/images_list.go @@ -3,8 +3,8 @@ package abi import ( "context" - libpodImage "github.com/containers/podman/v2/libpod/image" - "github.com/containers/podman/v2/pkg/domain/entities" + libpodImage "github.com/containers/podman/v3/libpod/image" + "github.com/containers/podman/v3/pkg/domain/entities" "github.com/pkg/errors" ) diff --git a/pkg/domain/infra/abi/manifest.go b/pkg/domain/infra/abi/manifest.go index 626f1f7bf..8e3c50fac 100644 --- a/pkg/domain/infra/abi/manifest.go +++ b/pkg/domain/infra/abi/manifest.go @@ -1,5 +1,3 @@ -// +build !remote - package abi import ( @@ -19,8 +17,8 @@ import ( "github.com/containers/image/v5/transports" "github.com/containers/image/v5/transports/alltransports" "github.com/containers/image/v5/types" - libpodImage "github.com/containers/podman/v2/libpod/image" - "github.com/containers/podman/v2/pkg/domain/entities" + libpodImage "github.com/containers/podman/v3/libpod/image" + "github.com/containers/podman/v3/pkg/domain/entities" "github.com/opencontainers/go-digest" imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" diff --git a/pkg/domain/infra/abi/network.go b/pkg/domain/infra/abi/network.go index 13fabe89d..50a74032c 100644 --- a/pkg/domain/infra/abi/network.go +++ b/pkg/domain/infra/abi/network.go @@ -3,10 +3,10 @@ package abi import ( "context" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/libpod/network" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/libpod/network" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/util" "github.com/pkg/errors" ) diff --git a/pkg/domain/infra/abi/parse/parse.go b/pkg/domain/infra/abi/parse/parse.go index 6a6380e33..1c590d2d6 100644 --- a/pkg/domain/infra/abi/parse/parse.go +++ b/pkg/domain/infra/abi/parse/parse.go @@ -4,8 +4,8 @@ import ( "strconv" "strings" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/define" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/define" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go index 70c7104f1..b7ca69281 100644 --- a/pkg/domain/infra/abi/play.go +++ b/pkg/domain/infra/abi/play.go @@ -9,13 +9,13 @@ import ( "strings" "github.com/containers/image/v5/types" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/libpod/image" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/specgen/generate" - "github.com/containers/podman/v2/pkg/specgen/generate/kube" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/libpod/image" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/specgen/generate" + "github.com/containers/podman/v3/pkg/specgen/generate/kube" + "github.com/containers/podman/v3/pkg/util" "github.com/docker/distribution/reference" "github.com/ghodss/yaml" "github.com/pkg/errors" @@ -60,7 +60,6 @@ func (ic *ContainerEngine) PlayKube(ctx context.Context, path string, options en default: return nil, errors.Errorf("invalid YAML kind: %q. [Pod|Deployment] are the only supported Kubernetes Kinds", kubeObject.Kind) } - } func (ic *ContainerEngine) playKubeDeployment(ctx context.Context, deploymentYAML *v1apps.Deployment, options entities.PlayKubeOptions) (*entities.PlayKubeReport, error) { @@ -222,7 +221,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY } // This ensures the image is the image store - newImage, err := ic.Libpod.ImageRuntime().New(ctx, container.Image, options.SignaturePolicy, options.Authfile, writer, &dockerRegistryOptions, image.SigningOptions{}, nil, pullPolicy) + newImage, err := ic.Libpod.ImageRuntime().New(ctx, container.Image, options.SignaturePolicy, options.Authfile, writer, &dockerRegistryOptions, image.SigningOptions{}, nil, pullPolicy, nil) if err != nil { return nil, err } diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go index 2a8445c9f..9f033a4c0 100644 --- a/pkg/domain/infra/abi/pods.go +++ b/pkg/domain/infra/abi/pods.go @@ -3,13 +3,13 @@ package abi import ( "context" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/domain/entities" - dfilters "github.com/containers/podman/v2/pkg/domain/filters" - "github.com/containers/podman/v2/pkg/signal" - "github.com/containers/podman/v2/pkg/specgen" - "github.com/containers/podman/v2/pkg/specgen/generate" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/domain/entities" + dfilters "github.com/containers/podman/v3/pkg/domain/filters" + "github.com/containers/podman/v3/pkg/signal" + "github.com/containers/podman/v3/pkg/specgen" + "github.com/containers/podman/v3/pkg/specgen/generate" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/pkg/domain/infra/abi/pods_stats.go b/pkg/domain/infra/abi/pods_stats.go index 29bcbe087..abb15bd1f 100644 --- a/pkg/domain/infra/abi/pods_stats.go +++ b/pkg/domain/infra/abi/pods_stats.go @@ -4,11 +4,11 @@ import ( "context" "fmt" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/pkg/cgroups" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/rootless" - "github.com/containers/podman/v2/utils" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/pkg/cgroups" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/rootless" + "github.com/containers/podman/v3/utils" "github.com/docker/go-units" "github.com/pkg/errors" ) diff --git a/pkg/domain/infra/abi/runtime.go b/pkg/domain/infra/abi/runtime.go index 3eab16479..3e7ea0d09 100644 --- a/pkg/domain/infra/abi/runtime.go +++ b/pkg/domain/infra/abi/runtime.go @@ -3,7 +3,7 @@ package abi import ( "sync" - "github.com/containers/podman/v2/libpod" + "github.com/containers/podman/v3/libpod" ) // Image-related runtime linked against libpod library diff --git a/pkg/domain/infra/abi/secrets.go b/pkg/domain/infra/abi/secrets.go index b1fe60e01..764f4a9dc 100644 --- a/pkg/domain/infra/abi/secrets.go +++ b/pkg/domain/infra/abi/secrets.go @@ -7,7 +7,7 @@ import ( "path/filepath" "github.com/containers/common/pkg/secrets" - "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/domain/entities" "github.com/pkg/errors" ) @@ -65,7 +65,6 @@ func (ic *ContainerEngine) SecretInspect(ctx context.Context, nameOrIDs []string }, } reports = append(reports, report) - } return reports, errs, nil diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go index f29b98696..9f7c8919b 100644 --- a/pkg/domain/infra/abi/system.go +++ b/pkg/domain/infra/abi/system.go @@ -12,14 +12,14 @@ import ( "strings" "github.com/containers/common/pkg/config" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/cgroups" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/domain/entities/reports" - "github.com/containers/podman/v2/pkg/rootless" - "github.com/containers/podman/v2/pkg/util" - "github.com/containers/podman/v2/utils" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/cgroups" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/domain/entities/reports" + "github.com/containers/podman/v3/pkg/rootless" + "github.com/containers/podman/v3/pkg/util" + "github.com/containers/podman/v3/utils" "github.com/containers/storage" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -82,7 +82,7 @@ func (ic *ContainerEngine) SetupRootless(_ context.Context, cmd *cobra.Command) unitName := fmt.Sprintf("podman-%d.scope", os.Getpid()) if runsUnderSystemd || conf.Engine.CgroupManager == config.SystemdCgroupsManager { if err := utils.RunUnderSystemdScope(os.Getpid(), "user.slice", unitName); err != nil { - logrus.Warnf("Failed to add podman to systemd sandbox cgroup: %v", err) + logrus.Debugf("Failed to add podman to systemd sandbox cgroup: %v", err) } } } diff --git a/pkg/domain/infra/abi/terminal/sigproxy_linux.go b/pkg/domain/infra/abi/terminal/sigproxy_linux.go index 2aca8f22d..26e199aee 100644 --- a/pkg/domain/infra/abi/terminal/sigproxy_linux.go +++ b/pkg/domain/infra/abi/terminal/sigproxy_linux.go @@ -4,10 +4,10 @@ import ( "os" "syscall" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/libpod/shutdown" - "github.com/containers/podman/v2/pkg/signal" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/libpod/shutdown" + "github.com/containers/podman/v3/pkg/signal" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/pkg/domain/infra/abi/terminal/terminal.go b/pkg/domain/infra/abi/terminal/terminal.go index 48f5749d5..067c0c08e 100644 --- a/pkg/domain/infra/abi/terminal/terminal.go +++ b/pkg/domain/infra/abi/terminal/terminal.go @@ -5,11 +5,11 @@ import ( "os" "os/signal" - lsignal "github.com/containers/podman/v2/pkg/signal" + "github.com/containers/podman/v3/libpod/define" + lsignal "github.com/containers/podman/v3/pkg/signal" "github.com/moby/term" "github.com/pkg/errors" "github.com/sirupsen/logrus" - "k8s.io/client-go/tools/remotecommand" ) // RawTtyFormatter ... @@ -18,20 +18,20 @@ type RawTtyFormatter struct { // getResize returns a TerminalSize command matching stdin's current // size on success, and nil on errors. -func getResize() *remotecommand.TerminalSize { +func getResize() *define.TerminalSize { winsize, err := term.GetWinsize(os.Stdin.Fd()) if err != nil { logrus.Warnf("Could not get terminal size %v", err) return nil } - return &remotecommand.TerminalSize{ + return &define.TerminalSize{ Width: winsize.Width, Height: winsize.Height, } } // Helper for prepareAttach - set up a goroutine to generate terminal resize events -func resizeTty(ctx context.Context, resize chan remotecommand.TerminalSize) { +func resizeTty(ctx context.Context, resize chan define.TerminalSize) { sigchan := make(chan os.Signal, 1) signal.Notify(sigchan, lsignal.SIGWINCH) go func() { @@ -78,7 +78,7 @@ func (f *RawTtyFormatter) Format(entry *logrus.Entry) ([]byte, error) { return bytes, err } -func handleTerminalAttach(ctx context.Context, resize chan remotecommand.TerminalSize) (context.CancelFunc, *term.State, error) { +func handleTerminalAttach(ctx context.Context, resize chan define.TerminalSize) (context.CancelFunc, *term.State, error) { logrus.Debugf("Handling terminal attach") subCtx, cancel := context.WithCancel(ctx) diff --git a/pkg/domain/infra/abi/terminal/terminal_linux.go b/pkg/domain/infra/abi/terminal/terminal_linux.go index 8886625a6..7a0c2907c 100644 --- a/pkg/domain/infra/abi/terminal/terminal_linux.go +++ b/pkg/domain/infra/abi/terminal/terminal_linux.go @@ -6,17 +6,16 @@ import ( "fmt" "os" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/define" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/define" "github.com/pkg/errors" "github.com/sirupsen/logrus" "golang.org/x/crypto/ssh/terminal" - "k8s.io/client-go/tools/remotecommand" ) // ExecAttachCtr execs and attaches to a container func ExecAttachCtr(ctx context.Context, ctr *libpod.Container, execConfig *libpod.ExecConfig, streams *define.AttachStreams) (int, error) { - resize := make(chan remotecommand.TerminalSize) + resize := make(chan define.TerminalSize) haveTerminal := terminal.IsTerminal(int(os.Stdin.Fd())) // Check if we are attached to a terminal. If we are, generate resize @@ -41,7 +40,7 @@ func ExecAttachCtr(ctx context.Context, ctr *libpod.Container, execConfig *libpo // if you change the signature of this function from os.File to io.Writer, it will trigger a downstream // error. we may need to just lint disable this one. func StartAttachCtr(ctx context.Context, ctr *libpod.Container, stdout, stderr, stdin *os.File, detachKeys string, sigProxy bool, startContainer bool, recursive bool) error { //nolint-interfacer - resize := make(chan remotecommand.TerminalSize) + resize := make(chan define.TerminalSize) haveTerminal := terminal.IsTerminal(int(os.Stdin.Fd())) diff --git a/pkg/domain/infra/abi/trust.go b/pkg/domain/infra/abi/trust.go index 4a12297f9..d3aff62ba 100644 --- a/pkg/domain/infra/abi/trust.go +++ b/pkg/domain/infra/abi/trust.go @@ -7,8 +7,8 @@ import ( "os" "strings" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/trust" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/trust" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/pkg/domain/infra/abi/volumes.go b/pkg/domain/infra/abi/volumes.go index f15aa2d14..e077b10ea 100644 --- a/pkg/domain/infra/abi/volumes.go +++ b/pkg/domain/infra/abi/volumes.go @@ -3,12 +3,12 @@ package abi import ( "context" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/domain/entities/reports" - "github.com/containers/podman/v2/pkg/domain/filters" - "github.com/containers/podman/v2/pkg/domain/infra/abi/parse" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/domain/entities/reports" + "github.com/containers/podman/v3/pkg/domain/filters" + "github.com/containers/podman/v3/pkg/domain/infra/abi/parse" "github.com/pkg/errors" ) diff --git a/pkg/domain/infra/runtime_abi.go b/pkg/domain/infra/runtime_abi.go index a25d165c9..ca201b5ae 100644 --- a/pkg/domain/infra/runtime_abi.go +++ b/pkg/domain/infra/runtime_abi.go @@ -6,11 +6,11 @@ import ( "context" "fmt" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/pkg/bindings" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/domain/infra/abi" - "github.com/containers/podman/v2/pkg/domain/infra/tunnel" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/pkg/bindings" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/domain/infra/abi" + "github.com/containers/podman/v3/pkg/domain/infra/tunnel" ) // NewContainerEngine factory provides a libpod runtime for container-related operations diff --git a/pkg/domain/infra/runtime_abi_unsupported.go b/pkg/domain/infra/runtime_abi_unsupported.go index bac552b1e..e7107ff38 100644 --- a/pkg/domain/infra/runtime_abi_unsupported.go +++ b/pkg/domain/infra/runtime_abi_unsupported.go @@ -5,7 +5,7 @@ package infra import ( "errors" - "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/domain/entities" ) // NewSystemEngine factory provides a libpod runtime for specialized system operations diff --git a/pkg/domain/infra/runtime_libpod.go b/pkg/domain/infra/runtime_libpod.go index b786a5fbf..8b6581c7b 100644 --- a/pkg/domain/infra/runtime_libpod.go +++ b/pkg/domain/infra/runtime_libpod.go @@ -9,12 +9,12 @@ import ( "os/signal" "sync" - "github.com/containers/podman/v2/cmd/podman/utils" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/pkg/cgroups" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/namespaces" - "github.com/containers/podman/v2/pkg/rootless" + "github.com/containers/podman/v3/cmd/podman/utils" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/pkg/cgroups" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/namespaces" + "github.com/containers/podman/v3/pkg/rootless" "github.com/containers/storage" "github.com/containers/storage/pkg/idtools" "github.com/pkg/errors" diff --git a/pkg/domain/infra/runtime_proxy.go b/pkg/domain/infra/runtime_proxy.go index 897dbbfc0..8fe264989 100644 --- a/pkg/domain/infra/runtime_proxy.go +++ b/pkg/domain/infra/runtime_proxy.go @@ -5,8 +5,8 @@ package infra import ( "context" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/domain/infra/abi" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/domain/infra/abi" flag "github.com/spf13/pflag" ) diff --git a/pkg/domain/infra/runtime_tunnel.go b/pkg/domain/infra/runtime_tunnel.go index b8aefaa35..185d223b7 100644 --- a/pkg/domain/infra/runtime_tunnel.go +++ b/pkg/domain/infra/runtime_tunnel.go @@ -7,9 +7,9 @@ import ( "fmt" "sync" - "github.com/containers/podman/v2/pkg/bindings" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/domain/infra/tunnel" + "github.com/containers/podman/v3/pkg/bindings" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/domain/infra/tunnel" ) var ( diff --git a/pkg/domain/infra/tunnel/auto-update.go b/pkg/domain/infra/tunnel/auto-update.go index 0ebd07588..41165cc74 100644 --- a/pkg/domain/infra/tunnel/auto-update.go +++ b/pkg/domain/infra/tunnel/auto-update.go @@ -3,7 +3,7 @@ package tunnel import ( "context" - "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/domain/entities" "github.com/pkg/errors" ) diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index e9c513f8e..a0f65f11f 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -12,15 +12,15 @@ import ( "github.com/containers/common/pkg/config" "github.com/containers/image/v5/docker/reference" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/libpod/events" - "github.com/containers/podman/v2/pkg/api/handlers" - "github.com/containers/podman/v2/pkg/bindings/containers" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/domain/entities/reports" - "github.com/containers/podman/v2/pkg/errorhandling" - "github.com/containers/podman/v2/pkg/specgen" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/libpod/events" + "github.com/containers/podman/v3/pkg/api/handlers" + "github.com/containers/podman/v3/pkg/bindings/containers" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/domain/entities/reports" + "github.com/containers/podman/v3/pkg/errorhandling" + "github.com/containers/podman/v3/pkg/specgen" + "github.com/containers/podman/v3/pkg/util" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -82,16 +82,23 @@ func (ic *ContainerEngine) ContainerUnpause(ctx context.Context, namesOrIds []st func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []string, opts entities.StopOptions) ([]*entities.StopReport, error) { reports := []*entities.StopReport{} - ctrs, err := getContainersByContext(ic.ClientCtx, opts.All, opts.Ignore, namesOrIds) + ctrs, rawInputs, err := getContainersAndInputByContext(ic.ClientCtx, opts.All, opts.Ignore, namesOrIds) if err != nil { return nil, err } + ctrMap := map[string]string{} + for i := range ctrs { + ctrMap[ctrs[i].ID] = rawInputs[i] + } options := new(containers.StopOptions).WithIgnore(opts.Ignore) if to := opts.Timeout; to != nil { options.WithTimeout(*to) } for _, c := range ctrs { - report := entities.StopReport{Id: c.ID} + report := entities.StopReport{ + Id: c.ID, + RawInput: ctrMap[c.ID], + } if err = containers.Stop(ic.ClientCtx, c.ID, options); err != nil { // These first two are considered non-fatal under the right conditions if errors.Cause(err).Error() == define.ErrCtrStopped.Error() { @@ -117,16 +124,21 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin } func (ic *ContainerEngine) ContainerKill(ctx context.Context, namesOrIds []string, opts entities.KillOptions) ([]*entities.KillReport, error) { - ctrs, err := getContainersByContext(ic.ClientCtx, opts.All, false, namesOrIds) + ctrs, rawInputs, err := getContainersAndInputByContext(ic.ClientCtx, opts.All, false, namesOrIds) if err != nil { return nil, err } + ctrMap := map[string]string{} + for i := range ctrs { + ctrMap[ctrs[i].ID] = rawInputs[i] + } options := new(containers.KillOptions).WithSignal(opts.Signal) reports := make([]*entities.KillReport, 0, len(ctrs)) for _, c := range ctrs { reports = append(reports, &entities.KillReport{ - Id: c.ID, - Err: containers.Kill(ic.ClientCtx, c.ID, options), + Id: c.ID, + Err: containers.Kill(ic.ClientCtx, c.ID, options), + RawInput: ctrMap[c.ID], }) } return reports, nil @@ -290,7 +302,6 @@ func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds [ ctrs = append(ctrs, c) } } - } else { ctrs, err = getContainersByContext(ic.ClientCtx, false, false, namesOrIds) if err != nil { @@ -326,7 +337,6 @@ func (ic *ContainerEngine) ContainerRestore(ctx context.Context, namesOrIds []st ctrs = append(ctrs, c) } } - } else { ctrs, err = getContainersByContext(ic.ClientCtx, false, false, namesOrIds) if err != nil { @@ -570,7 +580,6 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri } // Start the container if it's not running already. if !ctrRunning { - err = containers.Start(ic.ClientCtx, name, new(containers.StartOptions).WithDetachKeys(options.DetachKeys)) if err != nil { if ctr.AutoRemove { diff --git a/pkg/domain/infra/tunnel/events.go b/pkg/domain/infra/tunnel/events.go index cec6c749c..6e2c3f8ba 100644 --- a/pkg/domain/infra/tunnel/events.go +++ b/pkg/domain/infra/tunnel/events.go @@ -4,9 +4,9 @@ import ( "context" "strings" - "github.com/containers/podman/v2/libpod/events" - "github.com/containers/podman/v2/pkg/bindings/system" - "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v3/libpod/events" + "github.com/containers/podman/v3/pkg/bindings/system" + "github.com/containers/podman/v3/pkg/domain/entities" "github.com/pkg/errors" ) diff --git a/pkg/domain/infra/tunnel/generate.go b/pkg/domain/infra/tunnel/generate.go index 6d68157c1..0e768b30b 100644 --- a/pkg/domain/infra/tunnel/generate.go +++ b/pkg/domain/infra/tunnel/generate.go @@ -3,12 +3,12 @@ package tunnel import ( "context" - "github.com/containers/podman/v2/pkg/bindings/generate" - "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/bindings/generate" + "github.com/containers/podman/v3/pkg/domain/entities" ) func (ic *ContainerEngine) GenerateSystemd(ctx context.Context, nameOrID string, opts entities.GenerateSystemdOptions) (*entities.GenerateSystemdReport, error) { - options := new(generate.SystemdOptions).WithUseName(opts.Name).WithContainerPrefix(opts.ContainerPrefix).WithNew(opts.New) + options := new(generate.SystemdOptions).WithUseName(opts.Name).WithContainerPrefix(opts.ContainerPrefix).WithNew(opts.New).WithNoHeader(opts.NoHeader) options.WithPodPrefix(opts.PodPrefix).WithRestartPolicy(opts.RestartPolicy).WithSeparator(opts.Separator) if to := opts.StopTimeout; to != nil { options.WithStopTimeout(*opts.StopTimeout) diff --git a/pkg/domain/infra/tunnel/healthcheck.go b/pkg/domain/infra/tunnel/healthcheck.go index 3daf22647..9d37826e0 100644 --- a/pkg/domain/infra/tunnel/healthcheck.go +++ b/pkg/domain/infra/tunnel/healthcheck.go @@ -3,9 +3,9 @@ package tunnel import ( "context" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/bindings/containers" - "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/bindings/containers" + "github.com/containers/podman/v3/pkg/domain/entities" ) func (ic *ContainerEngine) HealthCheckRun(ctx context.Context, nameOrID string, options entities.HealthCheckOptions) (*define.HealthCheckResults, error) { diff --git a/pkg/domain/infra/tunnel/helpers.go b/pkg/domain/infra/tunnel/helpers.go index 0a806d860..f088d360b 100644 --- a/pkg/domain/infra/tunnel/helpers.go +++ b/pkg/domain/infra/tunnel/helpers.go @@ -3,27 +3,37 @@ package tunnel import ( "context" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/bindings/containers" - "github.com/containers/podman/v2/pkg/bindings/pods" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/errorhandling" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/bindings/containers" + "github.com/containers/podman/v3/pkg/bindings/pods" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/errorhandling" "github.com/pkg/errors" ) // FIXME: the `ignore` parameter is very likely wrong here as it should rather // be used on *errors* from operations such as remove. func getContainersByContext(contextWithConnection context.Context, all, ignore bool, namesOrIDs []string) ([]entities.ListContainer, error) { + ctrs, _, err := getContainersAndInputByContext(contextWithConnection, all, ignore, namesOrIDs) + return ctrs, err +} + +func getContainersAndInputByContext(contextWithConnection context.Context, all, ignore bool, namesOrIDs []string) ([]entities.ListContainer, []string, error) { if all && len(namesOrIDs) > 0 { - return nil, errors.New("cannot lookup containers and all") + return nil, nil, errors.New("cannot lookup containers and all") } options := new(containers.ListOptions).WithAll(true).WithSync(true) allContainers, err := containers.List(contextWithConnection, options) if err != nil { - return nil, err + return nil, nil, err } + rawInputs := []string{} if all { - return allContainers, err + for i := range allContainers { + rawInputs = append(rawInputs, allContainers[i].ID) + } + + return allContainers, rawInputs, err } // Note: it would be nicer if the lists endpoint would support that as @@ -42,7 +52,7 @@ func getContainersByContext(contextWithConnection context.Context, all, ignore b if ignore && errorhandling.Contains(err, define.ErrNoSuchCtr) { continue } - return nil, err + return nil, nil, err } // Now we can do a full match of the ID to find the right @@ -52,17 +62,17 @@ func getContainersByContext(contextWithConnection context.Context, all, ignore b for _, ctr := range allContainers { if ctr.ID == inspectData.ID { filtered = append(filtered, ctr) + rawInputs = append(rawInputs, nameOrID) found = true break } - } if !found && !ignore { - return nil, errors.Wrapf(define.ErrNoSuchCtr, "unable to find container %q", nameOrID) + return nil, nil, errors.Wrapf(define.ErrNoSuchCtr, "unable to find container %q", nameOrID) } } - return filtered, nil + return filtered, rawInputs, nil } func getPodsByContext(contextWithConnection context.Context, all bool, namesOrIDs []string) ([]*entities.ListPodsReport, error) { @@ -107,7 +117,6 @@ func getPodsByContext(contextWithConnection context.Context, all bool, namesOrID found = true break } - } if !found { diff --git a/pkg/domain/infra/tunnel/images.go b/pkg/domain/infra/tunnel/images.go index daad911cd..90b6e104b 100644 --- a/pkg/domain/infra/tunnel/images.go +++ b/pkg/domain/infra/tunnel/images.go @@ -11,13 +11,13 @@ import ( "github.com/containers/common/pkg/config" "github.com/containers/image/v5/docker/reference" "github.com/containers/image/v5/types" - "github.com/containers/podman/v2/libpod/image" - images "github.com/containers/podman/v2/pkg/bindings/images" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/domain/entities/reports" - "github.com/containers/podman/v2/pkg/domain/utils" - "github.com/containers/podman/v2/pkg/errorhandling" - utils2 "github.com/containers/podman/v2/utils" + "github.com/containers/podman/v3/libpod/image" + images "github.com/containers/podman/v3/pkg/bindings/images" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/domain/entities/reports" + "github.com/containers/podman/v3/pkg/domain/utils" + "github.com/containers/podman/v3/pkg/errorhandling" + utils2 "github.com/containers/podman/v3/utils" "github.com/pkg/errors" ) @@ -32,7 +32,6 @@ func (ir *ImageEngine) Remove(ctx context.Context, imagesArg []string, opts enti } func (ir *ImageEngine) List(ctx context.Context, opts entities.ImageListOptions) ([]*entities.ImageSummary, error) { - filters := make(map[string][]string, len(opts.Filter)) for _, filter := range opts.Filter { f := strings.Split(filter, "=") diff --git a/pkg/domain/infra/tunnel/manifest.go b/pkg/domain/infra/tunnel/manifest.go index e261afee2..8ac1f1420 100644 --- a/pkg/domain/infra/tunnel/manifest.go +++ b/pkg/domain/infra/tunnel/manifest.go @@ -7,9 +7,9 @@ import ( "strings" "github.com/containers/image/v5/types" - images "github.com/containers/podman/v2/pkg/bindings/images" - "github.com/containers/podman/v2/pkg/bindings/manifests" - "github.com/containers/podman/v2/pkg/domain/entities" + images "github.com/containers/podman/v3/pkg/bindings/images" + "github.com/containers/podman/v3/pkg/bindings/manifests" + "github.com/containers/podman/v3/pkg/domain/entities" "github.com/pkg/errors" ) diff --git a/pkg/domain/infra/tunnel/network.go b/pkg/domain/infra/tunnel/network.go index 990bfa880..adf34460c 100644 --- a/pkg/domain/infra/tunnel/network.go +++ b/pkg/domain/infra/tunnel/network.go @@ -3,9 +3,9 @@ package tunnel import ( "context" - "github.com/containers/podman/v2/pkg/bindings/network" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/errorhandling" + "github.com/containers/podman/v3/pkg/bindings/network" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/errorhandling" "github.com/pkg/errors" ) diff --git a/pkg/domain/infra/tunnel/play.go b/pkg/domain/infra/tunnel/play.go index 2318b9caa..9f9076114 100644 --- a/pkg/domain/infra/tunnel/play.go +++ b/pkg/domain/infra/tunnel/play.go @@ -4,8 +4,8 @@ import ( "context" "github.com/containers/image/v5/types" - "github.com/containers/podman/v2/pkg/bindings/play" - "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/bindings/play" + "github.com/containers/podman/v3/pkg/domain/entities" ) func (ic *ContainerEngine) PlayKube(ctx context.Context, path string, opts entities.PlayKubeOptions) (*entities.PlayKubeReport, error) { diff --git a/pkg/domain/infra/tunnel/pods.go b/pkg/domain/infra/tunnel/pods.go index d61c95d57..82f062b2c 100644 --- a/pkg/domain/infra/tunnel/pods.go +++ b/pkg/domain/infra/tunnel/pods.go @@ -3,11 +3,11 @@ package tunnel import ( "context" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/bindings/pods" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/specgen" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/bindings/pods" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/specgen" + "github.com/containers/podman/v3/pkg/util" "github.com/pkg/errors" ) diff --git a/pkg/domain/infra/tunnel/secrets.go b/pkg/domain/infra/tunnel/secrets.go index f7c0f7d13..1153f490e 100644 --- a/pkg/domain/infra/tunnel/secrets.go +++ b/pkg/domain/infra/tunnel/secrets.go @@ -4,9 +4,9 @@ import ( "context" "io" - "github.com/containers/podman/v2/pkg/bindings/secrets" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/errorhandling" + "github.com/containers/podman/v3/pkg/bindings/secrets" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/errorhandling" "github.com/pkg/errors" ) @@ -76,7 +76,6 @@ func (ic *ContainerEngine) SecretRm(ctx context.Context, nameOrIDs []string, opt Err: secrets.Remove(ic.ClientCtx, name), ID: secret.ID, }) - } return allRm, nil } diff --git a/pkg/domain/infra/tunnel/system.go b/pkg/domain/infra/tunnel/system.go index a46b164a5..d2c5063c9 100644 --- a/pkg/domain/infra/tunnel/system.go +++ b/pkg/domain/infra/tunnel/system.go @@ -4,9 +4,9 @@ import ( "context" "errors" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/bindings/system" - "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/bindings/system" + "github.com/containers/podman/v3/pkg/domain/entities" "github.com/spf13/cobra" ) diff --git a/pkg/domain/infra/tunnel/trust.go b/pkg/domain/infra/tunnel/trust.go index cf0faaf67..e0bd535ec 100644 --- a/pkg/domain/infra/tunnel/trust.go +++ b/pkg/domain/infra/tunnel/trust.go @@ -4,7 +4,7 @@ import ( "context" "errors" - "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/domain/entities" ) func (ir *ImageEngine) ShowTrust(ctx context.Context, args []string, options entities.ShowTrustOptions) (*entities.ShowTrustReport, error) { diff --git a/pkg/domain/infra/tunnel/volumes.go b/pkg/domain/infra/tunnel/volumes.go index ffd2c1d35..2d231bad6 100644 --- a/pkg/domain/infra/tunnel/volumes.go +++ b/pkg/domain/infra/tunnel/volumes.go @@ -3,10 +3,10 @@ package tunnel import ( "context" - "github.com/containers/podman/v2/pkg/bindings/volumes" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/domain/entities/reports" - "github.com/containers/podman/v2/pkg/errorhandling" + "github.com/containers/podman/v3/pkg/bindings/volumes" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/domain/entities/reports" + "github.com/containers/podman/v3/pkg/errorhandling" "github.com/pkg/errors" ) |