aboutsummaryrefslogtreecommitdiff
path: root/pkg/adapter/shortcuts
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2019-03-05 16:11:28 -0700
committerJhon Honce <jhonce@redhat.com>2019-04-09 11:55:26 -0700
commit09ff62429a324e01ad2c584afe9a5f66f580ae78 (patch)
tree6c896a4071b4c0df0d6ae4f95f171b6596d4367a /pkg/adapter/shortcuts
parentfe79bdd07e140176dc64ebef8da3eea2ae28b96b (diff)
downloadpodman-09ff62429a324e01ad2c584afe9a5f66f580ae78.tar.gz
podman-09ff62429a324e01ad2c584afe9a5f66f580ae78.tar.bz2
podman-09ff62429a324e01ad2c584afe9a5f66f580ae78.zip
Implement podman-remote rm
* refactor command output to use one function * Add new worker pool parallel operations * Implement podman-remote umount * Refactored podman wait to use printCmdOutput() Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/adapter/shortcuts')
-rw-r--r--pkg/adapter/shortcuts/shortcuts.go39
1 files changed, 18 insertions, 21 deletions
diff --git a/pkg/adapter/shortcuts/shortcuts.go b/pkg/adapter/shortcuts/shortcuts.go
index 677d88457..3e4eff555 100644
--- a/pkg/adapter/shortcuts/shortcuts.go
+++ b/pkg/adapter/shortcuts/shortcuts.go
@@ -1,6 +1,8 @@
package shortcuts
-import "github.com/containers/libpod/libpod"
+import (
+ "github.com/containers/libpod/libpod"
+)
// GetPodsByContext gets pods whether all, latest, or a slice of names/ids
func GetPodsByContext(all, latest bool, pods []string, runtime *libpod.Runtime) ([]*libpod.Pod, error) {
@@ -27,28 +29,23 @@ func GetPodsByContext(all, latest bool, pods []string, runtime *libpod.Runtime)
}
// GetContainersByContext gets pods whether all, latest, or a slice of names/ids
-func GetContainersByContext(all, latest bool, names []string, runtime *libpod.Runtime) ([]*libpod.Container, error) {
- var ctrs = []*libpod.Container{}
+func GetContainersByContext(all, latest bool, names []string, runtime *libpod.Runtime) (ctrs []*libpod.Container, err error) {
+ var ctr *libpod.Container
+ ctrs = []*libpod.Container{}
if all {
- return runtime.GetAllContainers()
- }
-
- if latest {
- c, err := runtime.GetLatestContainer()
- if err != nil {
- return nil, err
- }
- ctrs = append(ctrs, c)
- return ctrs, nil
- }
-
- for _, c := range names {
- ctr, err := runtime.LookupContainer(c)
- if err != nil {
- return nil, err
- }
+ ctrs, err = runtime.GetAllContainers()
+ } else if latest {
+ ctr, err = runtime.GetLatestContainer()
ctrs = append(ctrs, ctr)
+ } else {
+ for _, n := range names {
+ ctr, e := runtime.LookupContainer(n)
+ if e != nil && err == nil {
+ err = e
+ }
+ ctrs = append(ctrs, ctr)
+ }
}
- return ctrs, nil
+ return
}