summaryrefslogtreecommitdiff
path: root/cmd/podman/pods
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/pods')
-rw-r--r--cmd/podman/pods/common.go23
-rw-r--r--cmd/podman/pods/rm.go3
-rw-r--r--cmd/podman/pods/start.go3
-rw-r--r--cmd/podman/pods/stop.go3
4 files changed, 6 insertions, 26 deletions
diff --git a/cmd/podman/pods/common.go b/cmd/podman/pods/common.go
deleted file mode 100644
index 1c4195095..000000000
--- a/cmd/podman/pods/common.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package pods
-
-import (
- "io/ioutil"
- "strings"
-
- "github.com/pkg/errors"
-)
-
-// readPodIDFiles reads the specified files and returns their content (i.e.,
-// first line).
-func readPodIDFiles(files []string) ([]string, error) {
- ids := []string{}
- for _, podFile := range files {
- content, err := ioutil.ReadFile(podFile)
- if err != nil {
- return nil, errors.Wrap(err, "error reading pod ID file")
- }
- id := strings.Split(string(content), "\n")[0]
- ids = append(ids, id)
- }
- return ids, nil
-}
diff --git a/cmd/podman/pods/rm.go b/cmd/podman/pods/rm.go
index ecceda32a..8de0bce9e 100644
--- a/cmd/podman/pods/rm.go
+++ b/cmd/podman/pods/rm.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
+ "github.com/containers/libpod/cmd/podman/common"
"github.com/containers/libpod/cmd/podman/parse"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/cmd/podman/utils"
@@ -61,7 +62,7 @@ func rm(cmd *cobra.Command, args []string) error {
errs utils.OutputErrors
)
- ids, err := readPodIDFiles(rmOptions.PodIDFiles)
+ ids, err := common.ReadPodIDFiles(rmOptions.PodIDFiles)
if err != nil {
return err
}
diff --git a/cmd/podman/pods/start.go b/cmd/podman/pods/start.go
index 86517190d..97020b360 100644
--- a/cmd/podman/pods/start.go
+++ b/cmd/podman/pods/start.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
+ "github.com/containers/libpod/cmd/podman/common"
"github.com/containers/libpod/cmd/podman/parse"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/cmd/podman/utils"
@@ -61,7 +62,7 @@ func start(cmd *cobra.Command, args []string) error {
errs utils.OutputErrors
)
- ids, err := readPodIDFiles(startOptions.PodIDFiles)
+ ids, err := common.ReadPodIDFiles(startOptions.PodIDFiles)
if err != nil {
return err
}
diff --git a/cmd/podman/pods/stop.go b/cmd/podman/pods/stop.go
index fd66488f9..628e8a536 100644
--- a/cmd/podman/pods/stop.go
+++ b/cmd/podman/pods/stop.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
+ "github.com/containers/libpod/cmd/podman/common"
"github.com/containers/libpod/cmd/podman/parse"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/cmd/podman/utils"
@@ -68,7 +69,7 @@ func stop(cmd *cobra.Command, args []string) error {
stopOptions.Timeout = int(stopOptions.TimeoutCLI)
}
- ids, err := readPodIDFiles(stopOptions.PodIDFiles)
+ ids, err := common.ReadPodIDFiles(stopOptions.PodIDFiles)
if err != nil {
return err
}