summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-06-24 15:48:34 -0500
committerbaude <bbaude@redhat.com>2019-06-25 13:51:24 -0500
commitdd81a44ccfa34585ef62319835c8bb421db9e334 (patch)
tree7bab006a56d5823ccdf7b8cf6e59502ee954a979 /cmd/podman
parenta1a4a75abee2c381483a218e1660621ee416ef7c (diff)
downloadpodman-dd81a44ccfa34585ef62319835c8bb421db9e334.tar.gz
podman-dd81a44ccfa34585ef62319835c8bb421db9e334.tar.bz2
podman-dd81a44ccfa34585ef62319835c8bb421db9e334.zip
remove libpod from main
the compilation demands of having libpod in main is a burden for the remote client compilations. to combat this, we should move the use of libpod structs, vars, constants, and functions into the adapter code where it will only be compiled by the local client. this should result in cleaner code organization and smaller binaries. it should also help if we ever need to compile the remote client on non-Linux operating systems natively (not cross-compiled). Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/checkpoint.go11
-rw-r--r--cmd/podman/commit.go8
-rw-r--r--cmd/podman/common.go58
-rw-r--r--cmd/podman/common_libpod.go64
-rw-r--r--cmd/podman/containers_prune.go4
-rw-r--r--cmd/podman/cp.go7
-rw-r--r--cmd/podman/exec.go3
-rw-r--r--cmd/podman/exists.go10
-rw-r--r--cmd/podman/pause.go4
-rw-r--r--cmd/podman/pod_stats.go3
-rw-r--r--cmd/podman/restart.go10
-rw-r--r--cmd/podman/rm.go4
-rw-r--r--cmd/podman/runlabel.go4
-rw-r--r--cmd/podman/shared/container.go3
-rw-r--r--cmd/podman/start.go4
-rw-r--r--cmd/podman/stats.go7
-rw-r--r--cmd/podman/stop.go6
-rw-r--r--cmd/podman/unpause.go4
18 files changed, 113 insertions, 101 deletions
diff --git a/cmd/podman/checkpoint.go b/cmd/podman/checkpoint.go
index 86bc8b973..bfb5b49d4 100644
--- a/cmd/podman/checkpoint.go
+++ b/cmd/podman/checkpoint.go
@@ -2,7 +2,6 @@ package main
import (
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/adapter"
"github.com/containers/libpod/pkg/rootless"
"github.com/pkg/errors"
@@ -59,13 +58,7 @@ func checkpointCmd(c *cliconfig.CheckpointValues) error {
if err != nil {
return errors.Wrapf(err, "could not get runtime")
}
- defer runtime.Shutdown(false)
- options := libpod.ContainerCheckpointOptions{
- Keep: c.Keep,
- KeepRunning: c.LeaveRunning,
- TCPEstablished: c.TcpEstablished,
- TargetFile: c.Export,
- }
- return runtime.Checkpoint(c, options)
+ defer runtime.Shutdown(false)
+ return runtime.Checkpoint(c)
}
diff --git a/cmd/podman/commit.go b/cmd/podman/commit.go
index db0b8241e..c49645a1d 100644
--- a/cmd/podman/commit.go
+++ b/cmd/podman/commit.go
@@ -5,7 +5,6 @@ import (
"strings"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/adapter"
"github.com/containers/libpod/pkg/util"
"github.com/pkg/errors"
@@ -30,6 +29,9 @@ var (
podman commit -q --author "firstName lastName" reverent_golick image-committed
podman commit -q --pause=false containerID image-committed`,
}
+
+ // ChangeCmds is the list of valid Changes commands to passed to the Commit call
+ ChangeCmds = []string{"CMD", "ENTRYPOINT", "ENV", "EXPOSE", "LABEL", "ONBUILD", "STOPSIGNAL", "USER", "VOLUME", "WORKDIR"}
)
func init() {
@@ -37,7 +39,7 @@ func init() {
commitCommand.SetHelpTemplate(HelpTemplate())
commitCommand.SetUsageTemplate(UsageTemplate())
flags := commitCommand.Flags()
- flags.StringArrayVarP(&commitCommand.Change, "change", "c", []string{}, fmt.Sprintf("Apply the following possible instructions to the created image (default []): %s", strings.Join(libpod.ChangeCmds, " | ")))
+ flags.StringArrayVarP(&commitCommand.Change, "change", "c", []string{}, fmt.Sprintf("Apply the following possible instructions to the created image (default []): %s", strings.Join(ChangeCmds, " | ")))
flags.StringVarP(&commitCommand.Format, "format", "f", "oci", "`Format` of the image manifest and metadata")
flags.StringVarP(&commitCommand.Message, "message", "m", "", "Set commit message for imported image")
flags.StringVarP(&commitCommand.Author, "author", "a", "", "Set the author for the image committed")
@@ -66,7 +68,7 @@ func commitCmd(c *cliconfig.CommitValues) error {
if len(splitChange) == 1 {
splitChange = strings.Split(strings.ToUpper(change), " ")
}
- if !util.StringInSlice(splitChange[0], libpod.ChangeCmds) {
+ if !util.StringInSlice(splitChange[0], ChangeCmds) {
return errors.Errorf("invalid syntax for --change: %s", change)
}
}
diff --git a/cmd/podman/common.go b/cmd/podman/common.go
index 054b01247..7a3052653 100644
--- a/cmd/podman/common.go
+++ b/cmd/podman/common.go
@@ -9,7 +9,7 @@ import (
"github.com/containers/buildah"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/rootless"
"github.com/containers/storage"
"github.com/fatih/camelcase"
@@ -80,58 +80,6 @@ func commandRunE() func(*cobra.Command, []string) error {
}
}
-// getAllOrLatestContainers tries to return the correct list of containers
-// depending if --all, --latest or <container-id> is used.
-// It requires the Context (c) and the Runtime (runtime). As different
-// commands are using different container state for the --all option
-// the desired state has to be specified in filterState. If no filter
-// is desired a -1 can be used to get all containers. For a better
-// error message, if the filter fails, a corresponding verb can be
-// specified which will then appear in the error message.
-func getAllOrLatestContainers(c *cliconfig.PodmanCommand, runtime *libpod.Runtime, filterState libpod.ContainerStatus, verb string) ([]*libpod.Container, error) {
- var containers []*libpod.Container
- var lastError error
- var err error
- if c.Bool("all") {
- if filterState != -1 {
- var filterFuncs []libpod.ContainerFilter
- filterFuncs = append(filterFuncs, func(c *libpod.Container) bool {
- state, _ := c.State()
- return state == filterState
- })
- containers, err = runtime.GetContainers(filterFuncs...)
- } else {
- containers, err = runtime.GetContainers()
- }
- if err != nil {
- return nil, errors.Wrapf(err, "unable to get %s containers", verb)
- }
- } else if c.Bool("latest") {
- lastCtr, err := runtime.GetLatestContainer()
- if err != nil {
- return nil, errors.Wrapf(err, "unable to get latest container")
- }
- containers = append(containers, lastCtr)
- } else {
- args := c.InputArgs
- for _, i := range args {
- container, err := runtime.LookupContainer(i)
- if err != nil {
- if lastError != nil {
- fmt.Fprintln(os.Stderr, lastError)
- }
- lastError = errors.Wrapf(err, "unable to find container %s", i)
- }
- if container != nil {
- // This is here to make sure this does not return [<nil>] but only nil
- containers = append(containers, container)
- }
- }
- }
-
- return containers, lastError
-}
-
// getContext returns a non-nil, empty context
func getContext() context.Context {
if Ctx != nil {
@@ -333,7 +281,7 @@ func getCreateFlags(c *cliconfig.PodmanCommand) {
createFlags.String(
"init-path", "",
// Do not use the Value field for setting the default value to determine user input (i.e., non-empty string)
- fmt.Sprintf("Path to the container-init binary (default: %q)", libpod.DefaultInitPath),
+ fmt.Sprintf("Path to the container-init binary (default: %q)", define.DefaultInitPath),
)
createFlags.BoolP(
"interactive", "i", false,
@@ -472,7 +420,7 @@ func getCreateFlags(c *cliconfig.PodmanCommand) {
"Signal to stop a container. Default is SIGTERM",
)
createFlags.Uint(
- "stop-timeout", libpod.CtrRemoveTimeout,
+ "stop-timeout", define.CtrRemoveTimeout,
"Timeout (in seconds) to stop a container. Default is 10",
)
createFlags.StringSlice(
diff --git a/cmd/podman/common_libpod.go b/cmd/podman/common_libpod.go
new file mode 100644
index 000000000..45b2687cb
--- /dev/null
+++ b/cmd/podman/common_libpod.go
@@ -0,0 +1,64 @@
+//build !remoteclient
+
+package main
+
+import (
+ "fmt"
+ "os"
+
+ "github.com/containers/libpod/cmd/podman/cliconfig"
+ "github.com/containers/libpod/libpod"
+ "github.com/pkg/errors"
+)
+
+// getAllOrLatestContainers tries to return the correct list of containers
+// depending if --all, --latest or <container-id> is used.
+// It requires the Context (c) and the Runtime (runtime). As different
+// commands are using different container state for the --all option
+// the desired state has to be specified in filterState. If no filter
+// is desired a -1 can be used to get all containers. For a better
+// error message, if the filter fails, a corresponding verb can be
+// specified which will then appear in the error message.
+func getAllOrLatestContainers(c *cliconfig.PodmanCommand, runtime *libpod.Runtime, filterState libpod.ContainerStatus, verb string) ([]*libpod.Container, error) {
+ var containers []*libpod.Container
+ var lastError error
+ var err error
+ if c.Bool("all") {
+ if filterState != -1 {
+ var filterFuncs []libpod.ContainerFilter
+ filterFuncs = append(filterFuncs, func(c *libpod.Container) bool {
+ state, _ := c.State()
+ return state == filterState
+ })
+ containers, err = runtime.GetContainers(filterFuncs...)
+ } else {
+ containers, err = runtime.GetContainers()
+ }
+ if err != nil {
+ return nil, errors.Wrapf(err, "unable to get %s containers", verb)
+ }
+ } else if c.Bool("latest") {
+ lastCtr, err := runtime.GetLatestContainer()
+ if err != nil {
+ return nil, errors.Wrapf(err, "unable to get latest container")
+ }
+ containers = append(containers, lastCtr)
+ } else {
+ args := c.InputArgs
+ for _, i := range args {
+ container, err := runtime.LookupContainer(i)
+ if err != nil {
+ if lastError != nil {
+ fmt.Fprintln(os.Stderr, lastError)
+ }
+ lastError = errors.Wrapf(err, "unable to find container %s", i)
+ }
+ if container != nil {
+ // This is here to make sure this does not return [<nil>] but only nil
+ containers = append(containers, container)
+ }
+ }
+ }
+
+ return containers, lastError
+}
diff --git a/cmd/podman/containers_prune.go b/cmd/podman/containers_prune.go
index b052bda36..97481fb35 100644
--- a/cmd/podman/containers_prune.go
+++ b/cmd/podman/containers_prune.go
@@ -3,7 +3,7 @@ package main
import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/shared"
- "github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@@ -51,7 +51,7 @@ func pruneContainersCmd(c *cliconfig.PruneContainersValues) error {
}
ok, failures, err := runtime.Prune(getContext(), maxWorkers, c.Force)
if err != nil {
- if errors.Cause(err) == libpod.ErrNoSuchCtr {
+ if errors.Cause(err) == define.ErrNoSuchCtr {
if len(c.InputArgs) > 1 {
exitCode = 125
} else {
diff --git a/cmd/podman/cp.go b/cmd/podman/cp.go
index a9418e6e0..6c5e4ee43 100644
--- a/cmd/podman/cp.go
+++ b/cmd/podman/cp.go
@@ -13,14 +13,15 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/libpodruntime"
"github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/rootless"
"github.com/containers/storage"
"github.com/containers/storage/pkg/archive"
"github.com/containers/storage/pkg/chrootarchive"
"github.com/containers/storage/pkg/idtools"
securejoin "github.com/cyphar/filepath-securejoin"
- digest "github.com/opencontainers/go-digest"
- specs "github.com/opencontainers/runtime-spec/specs-go"
+ "github.com/opencontainers/go-digest"
+ "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -114,7 +115,7 @@ func copyBetweenHostAndContainer(runtime *libpod.Runtime, src string, dest strin
// TODO: We can potentially start the container while
// the copy is running, which still allows a race where
// malicious code could mess with the symlink.
- if errors.Cause(err) != libpod.ErrCtrStateInvalid {
+ if errors.Cause(err) != define.ErrCtrStateInvalid {
return err
}
} else if err == nil {
diff --git a/cmd/podman/exec.go b/cmd/podman/exec.go
index 0684da842..93a4befbd 100644
--- a/cmd/podman/exec.go
+++ b/cmd/podman/exec.go
@@ -10,6 +10,7 @@ import (
"github.com/containers/libpod/cmd/podman/libpodruntime"
"github.com/containers/libpod/cmd/podman/shared/parse"
"github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -126,7 +127,7 @@ func execCmd(c *cliconfig.ExecValues) error {
streams.AttachInput = true
err = ctr.Exec(c.Tty, c.Privileged, envs, cmd, c.User, c.Workdir, streams, c.PreserveFDs)
- if errors.Cause(err) == libpod.ErrCtrStateInvalid {
+ if errors.Cause(err) == define.ErrCtrStateInvalid {
exitCode = 126
}
diff --git a/cmd/podman/exists.go b/cmd/podman/exists.go
index 6619522b6..3d001f3d1 100644
--- a/cmd/podman/exists.go
+++ b/cmd/podman/exists.go
@@ -1,14 +1,14 @@
package main
import (
- "github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/spf13/cobra"
"os"
- "github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/cmd/podman/cliconfig"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/libpod/image"
"github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
+ "github.com/spf13/cobra"
)
var (
@@ -113,7 +113,7 @@ func containerExistsCmd(c *cliconfig.ContainerExistsValues) error {
}
defer runtime.Shutdown(false)
if _, err := runtime.LookupContainer(args[0]); err != nil {
- if errors.Cause(err) == libpod.ErrNoSuchCtr || err.Error() == "io.podman.ContainerNotFound" {
+ if errors.Cause(err) == define.ErrNoSuchCtr || err.Error() == "io.podman.ContainerNotFound" {
os.Exit(1)
}
return err
@@ -133,7 +133,7 @@ func podExistsCmd(c *cliconfig.PodExistsValues) error {
defer runtime.Shutdown(false)
if _, err := runtime.LookupPod(args[0]); err != nil {
- if errors.Cause(err) == libpod.ErrNoSuchPod || err.Error() == "io.podman.PodNotFound" {
+ if errors.Cause(err) == define.ErrNoSuchPod || err.Error() == "io.podman.PodNotFound" {
os.Exit(1)
}
return err
diff --git a/cmd/podman/pause.go b/cmd/podman/pause.go
index cd8370082..4bef20867 100644
--- a/cmd/podman/pause.go
+++ b/cmd/podman/pause.go
@@ -4,7 +4,7 @@ import (
"os"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@@ -55,7 +55,7 @@ func pauseCmd(c *cliconfig.PauseValues) error {
}
ok, failures, err := runtime.PauseContainers(getContext(), c)
if err != nil {
- if errors.Cause(err) == libpod.ErrNoSuchCtr {
+ if errors.Cause(err) == define.ErrNoSuchCtr {
if len(c.InputArgs) > 1 {
exitCode = 125
} else {
diff --git a/cmd/podman/pod_stats.go b/cmd/podman/pod_stats.go
index e0e5ca24e..c33c97602 100644
--- a/cmd/podman/pod_stats.go
+++ b/cmd/podman/pod_stats.go
@@ -13,6 +13,7 @@ import (
"github.com/containers/buildah/pkg/formats"
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@@ -153,7 +154,7 @@ func podStatsCmd(c *cliconfig.PodStatsValues) error {
for _, p := range pods {
prevStat := getPreviousPodContainerStats(p.ID(), previousPodStats)
newPodStats, err := p.GetPodStats(prevStat)
- if errors.Cause(err) == libpod.ErrNoSuchPod {
+ if errors.Cause(err) == define.ErrNoSuchPod {
continue
}
if err != nil {
diff --git a/cmd/podman/restart.go b/cmd/podman/restart.go
index 437676eef..89bda7d6c 100644
--- a/cmd/podman/restart.go
+++ b/cmd/podman/restart.go
@@ -2,7 +2,7 @@ package main
import (
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@@ -39,8 +39,8 @@ func init() {
flags.BoolVarP(&restartCommand.All, "all", "a", false, "Restart all non-running containers")
flags.BoolVarP(&restartCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
flags.BoolVar(&restartCommand.Running, "running", false, "Restart only running containers when --all is used")
- flags.UintVarP(&restartCommand.Timeout, "timeout", "t", libpod.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
- flags.UintVar(&restartCommand.Timeout, "time", libpod.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
+ flags.UintVarP(&restartCommand.Timeout, "timeout", "t", define.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
+ flags.UintVar(&restartCommand.Timeout, "time", define.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
markFlagHiddenForRemoteClient("latest", flags)
}
@@ -48,7 +48,7 @@ func init() {
func restartCmd(c *cliconfig.RestartValues) error {
all := c.All
if len(c.InputArgs) < 1 && !c.Latest && !all {
- return errors.Wrapf(libpod.ErrInvalidArg, "you must provide at least one container name or ID")
+ return errors.Wrapf(define.ErrInvalidArg, "you must provide at least one container name or ID")
}
runtime, err := adapter.GetRuntime(getContext(), &c.PodmanCommand)
@@ -59,7 +59,7 @@ func restartCmd(c *cliconfig.RestartValues) error {
ok, failures, err := runtime.Restart(getContext(), c)
if err != nil {
- if errors.Cause(err) == libpod.ErrNoSuchCtr {
+ if errors.Cause(err) == define.ErrNoSuchCtr {
if len(c.InputArgs) > 1 {
exitCode = 125
} else {
diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go
index 2710a8194..0f81a0d63 100644
--- a/cmd/podman/rm.go
+++ b/cmd/podman/rm.go
@@ -4,7 +4,7 @@ import (
"fmt"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@@ -65,7 +65,7 @@ func rmCmd(c *cliconfig.RmValues) error {
ok, failures, err := runtime.RemoveContainers(getContext(), c)
if err != nil {
- if errors.Cause(err) == libpod.ErrNoSuchCtr {
+ if errors.Cause(err) == define.ErrNoSuchCtr {
if len(c.InputArgs) > 1 {
exitCode = 125
} else {
diff --git a/cmd/podman/runlabel.go b/cmd/podman/runlabel.go
index 59cbc7aa4..be5d29139 100644
--- a/cmd/podman/runlabel.go
+++ b/cmd/podman/runlabel.go
@@ -10,7 +10,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/libpodruntime"
"github.com/containers/libpod/cmd/podman/shared"
- "github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/libpod/image"
"github.com/containers/libpod/pkg/util"
"github.com/containers/libpod/utils"
@@ -169,7 +169,7 @@ func runlabelCmd(c *cliconfig.RunlabelValues) error {
name := cmd[i+1]
ctr, err := runtime.LookupContainer(name)
if err != nil {
- if errors.Cause(err) != libpod.ErrNoSuchCtr {
+ if errors.Cause(err) != define.ErrNoSuchCtr {
logrus.Debugf("Error occurred searching for container %s: %s", name, err.Error())
return err
}
diff --git a/cmd/podman/shared/container.go b/cmd/podman/shared/container.go
index f24a2358f..4adb9f0bb 100644
--- a/cmd/podman/shared/container.go
+++ b/cmd/podman/shared/container.go
@@ -15,6 +15,7 @@ import (
"github.com/containers/image/types"
"github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/libpod/image"
"github.com/containers/libpod/pkg/util"
"github.com/cri-o/ocicni/pkg/ocicni"
@@ -824,7 +825,7 @@ func GenerateKube(name string, service bool, r *libpod.Runtime) (*v1.Pod, *v1.Se
podYAML, servicePorts, err = pod.GenerateForKube()
} else {
if len(container.Dependencies()) > 0 {
- return nil, nil, errors.Wrapf(libpod.ErrNotImplemented, "containers with dependencies")
+ return nil, nil, errors.Wrapf(define.ErrNotImplemented, "containers with dependencies")
}
podYAML, err = container.GenerateForKube()
}
diff --git a/cmd/podman/start.go b/cmd/podman/start.go
index bd34010f2..904cca297 100644
--- a/cmd/podman/start.go
+++ b/cmd/podman/start.go
@@ -2,7 +2,7 @@ package main
import (
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/adapter"
"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
@@ -62,7 +62,7 @@ func startCmd(c *cliconfig.StartValues) error {
sigProxy := c.SigProxy || attach
if sigProxy && !attach {
- return errors.Wrapf(libpod.ErrInvalidArg, "you cannot use sig-proxy without --attach")
+ return errors.Wrapf(define.ErrInvalidArg, "you cannot use sig-proxy without --attach")
}
runtime, err := adapter.GetRuntime(getContext(), &c.PodmanCommand)
diff --git a/cmd/podman/stats.go b/cmd/podman/stats.go
index c2b2a688c..d79eebc3d 100644
--- a/cmd/podman/stats.go
+++ b/cmd/podman/stats.go
@@ -12,6 +12,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/libpodruntime"
"github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/docker/go-units"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@@ -127,7 +128,7 @@ func statsCmd(c *cliconfig.StatsValues) error {
initialStats, err := ctr.GetContainerStats(&libpod.ContainerStats{})
if err != nil {
// when doing "all", dont worry about containers that are not running
- if c.All && errors.Cause(err) == libpod.ErrCtrRemoved || errors.Cause(err) == libpod.ErrNoSuchCtr || errors.Cause(err) == libpod.ErrCtrStateInvalid {
+ if c.All && errors.Cause(err) == define.ErrCtrRemoved || errors.Cause(err) == define.ErrNoSuchCtr || errors.Cause(err) == define.ErrCtrStateInvalid {
continue
}
return err
@@ -148,7 +149,7 @@ func statsCmd(c *cliconfig.StatsValues) error {
id := ctr.ID()
if _, ok := containerStats[ctr.ID()]; !ok {
initialStats, err := ctr.GetContainerStats(&libpod.ContainerStats{})
- if errors.Cause(err) == libpod.ErrCtrRemoved || errors.Cause(err) == libpod.ErrNoSuchCtr || errors.Cause(err) == libpod.ErrCtrStateInvalid {
+ if errors.Cause(err) == define.ErrCtrRemoved || errors.Cause(err) == define.ErrNoSuchCtr || errors.Cause(err) == define.ErrCtrStateInvalid {
// skip dealing with a container that is gone
continue
}
@@ -158,7 +159,7 @@ func statsCmd(c *cliconfig.StatsValues) error {
containerStats[id] = initialStats
}
stats, err := ctr.GetContainerStats(containerStats[id])
- if err != nil && errors.Cause(err) != libpod.ErrNoSuchCtr {
+ if err != nil && errors.Cause(err) != define.ErrNoSuchCtr {
return err
}
// replace the previous measurement with the current one
diff --git a/cmd/podman/stop.go b/cmd/podman/stop.go
index d88c90deb..5c93904ef 100644
--- a/cmd/podman/stop.go
+++ b/cmd/podman/stop.go
@@ -2,7 +2,7 @@ package main
import (
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/adapter"
"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
@@ -40,8 +40,8 @@ func init() {
flags := stopCommand.Flags()
flags.BoolVarP(&stopCommand.All, "all", "a", false, "Stop all running containers")
flags.BoolVarP(&stopCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
- flags.UintVar(&stopCommand.Timeout, "time", libpod.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
- flags.UintVarP(&stopCommand.Timeout, "timeout", "t", libpod.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
+ flags.UintVar(&stopCommand.Timeout, "time", define.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
+ flags.UintVarP(&stopCommand.Timeout, "timeout", "t", define.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
markFlagHiddenForRemoteClient("latest", flags)
}
diff --git a/cmd/podman/unpause.go b/cmd/podman/unpause.go
index 2cd6846fe..55bfe584e 100644
--- a/cmd/podman/unpause.go
+++ b/cmd/podman/unpause.go
@@ -4,7 +4,7 @@ import (
"os"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@@ -54,7 +54,7 @@ func unpauseCmd(c *cliconfig.UnpauseValues) error {
}
ok, failures, err := runtime.UnpauseContainers(getContext(), c)
if err != nil {
- if errors.Cause(err) == libpod.ErrNoSuchCtr {
+ if errors.Cause(err) == define.ErrNoSuchCtr {
if len(c.InputArgs) > 1 {
exitCode = 125
} else {