summaryrefslogtreecommitdiff
path: root/pkg/ps/ps.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/ps/ps.go')
-rw-r--r--pkg/ps/ps.go34
1 files changed, 24 insertions, 10 deletions
diff --git a/pkg/ps/ps.go b/pkg/ps/ps.go
index 0b76636de..ef79973d6 100644
--- a/pkg/ps/ps.go
+++ b/pkg/ps/ps.go
@@ -71,18 +71,11 @@ func GetContainerLists(runtime *libpod.Runtime, options entities.ContainerListOp
}
if options.All && options.External {
- externCons, err := runtime.StorageContainers()
+ listCon, err := GetExternalContainerLists(runtime)
if err != nil {
return nil, err
}
-
- for _, con := range externCons {
- listCon, err := ListStorageContainer(runtime, con, options)
- if err != nil {
- return nil, err
- }
- pss = append(pss, listCon)
- }
+ pss = append(pss, listCon...)
}
// Sort the containers we got
@@ -97,6 +90,27 @@ func GetContainerLists(runtime *libpod.Runtime, options entities.ContainerListOp
return pss, nil
}
+// GetExternalContainerLists returns list of external containers for e.g created by buildah
+func GetExternalContainerLists(runtime *libpod.Runtime) ([]entities.ListContainer, error) {
+ var (
+ pss = []entities.ListContainer{}
+ )
+
+ externCons, err := runtime.StorageContainers()
+ if err != nil {
+ return nil, err
+ }
+
+ for _, con := range externCons {
+ listCon, err := ListStorageContainer(runtime, con)
+ if err != nil {
+ return nil, err
+ }
+ pss = append(pss, listCon)
+ }
+ return pss, nil
+}
+
// BatchContainerOp is used in ps to reduce performance hits by "batching"
// locks.
func ListContainerBatch(rt *libpod.Runtime, ctr *libpod.Container, opts entities.ContainerListOptions) (entities.ListContainer, error) {
@@ -231,7 +245,7 @@ func ListContainerBatch(rt *libpod.Runtime, ctr *libpod.Container, opts entities
return ps, nil
}
-func ListStorageContainer(rt *libpod.Runtime, ctr storage.Container, opts entities.ContainerListOptions) (entities.ListContainer, error) {
+func ListStorageContainer(rt *libpod.Runtime, ctr storage.Container) (entities.ListContainer, error) {
name := "unknown"
if len(ctr.Names) > 0 {
name = ctr.Names[0]