diff options
Diffstat (limited to 'cmd')
62 files changed, 289 insertions, 259 deletions
diff --git a/cmd/podman/attach.go b/cmd/podman/attach.go index f615ce026..91c5f654d 100644 --- a/cmd/podman/attach.go +++ b/cmd/podman/attach.go @@ -3,9 +3,9 @@ package main import ( "os" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) diff --git a/cmd/podman/build.go b/cmd/podman/build.go index b8e586811..e35fd10a4 100644 --- a/cmd/podman/build.go +++ b/cmd/podman/build.go @@ -6,11 +6,13 @@ import ( "path/filepath" "strings" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/pkg/rootless" "github.com/pkg/errors" + "github.com/projectatomic/buildah" "github.com/projectatomic/buildah/imagebuildah" buildahcli "github.com/projectatomic/buildah/pkg/cli" "github.com/projectatomic/buildah/pkg/parse" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) @@ -229,5 +231,9 @@ func buildCmd(c *cli.Context) error { options.ReportWriter = ioutil.Discard } + if rootless.IsRootless() { + options.Isolation = buildah.IsolationOCIRootless + } + return runtime.Build(getContext(), options, dockerfiles...) } diff --git a/cmd/podman/cleanup.go b/cmd/podman/cleanup.go index 33b0fad45..a71b3f48a 100644 --- a/cmd/podman/cleanup.go +++ b/cmd/podman/cleanup.go @@ -4,9 +4,9 @@ import ( "fmt" "os" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) diff --git a/cmd/podman/commit.go b/cmd/podman/commit.go index 8d3c124bf..03210dc35 100644 --- a/cmd/podman/commit.go +++ b/cmd/podman/commit.go @@ -7,12 +7,12 @@ import ( "strings" "github.com/containers/image/manifest" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" + "github.com/containers/libpod/libpod/image" + "github.com/containers/libpod/pkg/util" "github.com/pkg/errors" "github.com/projectatomic/buildah" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" - "github.com/projectatomic/libpod/libpod/image" - "github.com/projectatomic/libpod/pkg/util" "github.com/urfave/cli" ) diff --git a/cmd/podman/common.go b/cmd/podman/common.go index 93fa9653a..8ce3066c0 100644 --- a/cmd/podman/common.go +++ b/cmd/podman/common.go @@ -6,10 +6,10 @@ import ( "regexp" "strings" + "github.com/containers/libpod/libpod" "github.com/containers/storage" "github.com/fatih/camelcase" "github.com/pkg/errors" - "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) diff --git a/cmd/podman/create.go b/cmd/podman/create.go index ad6f53b55..96934560f 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -9,21 +9,21 @@ import ( "strings" "syscall" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" + "github.com/containers/libpod/libpod/image" + ann "github.com/containers/libpod/pkg/annotations" + "github.com/containers/libpod/pkg/apparmor" + "github.com/containers/libpod/pkg/inspect" + cc "github.com/containers/libpod/pkg/spec" + "github.com/containers/libpod/pkg/util" + libpodVersion "github.com/containers/libpod/version" "github.com/docker/docker/api/types/container" "github.com/docker/docker/pkg/signal" "github.com/docker/go-connections/nat" "github.com/docker/go-units" "github.com/opencontainers/selinux/go-selinux/label" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" - "github.com/projectatomic/libpod/libpod/image" - ann "github.com/projectatomic/libpod/pkg/annotations" - "github.com/projectatomic/libpod/pkg/apparmor" - "github.com/projectatomic/libpod/pkg/inspect" - cc "github.com/projectatomic/libpod/pkg/spec" - "github.com/projectatomic/libpod/pkg/util" - libpodVersion "github.com/projectatomic/libpod/version" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/create_cli.go b/cmd/podman/create_cli.go index d0ad28595..812b62058 100644 --- a/cmd/podman/create_cli.go +++ b/cmd/podman/create_cli.go @@ -6,9 +6,9 @@ import ( "path/filepath" "strings" + cc "github.com/containers/libpod/pkg/spec" "github.com/docker/docker/pkg/sysinfo" "github.com/pkg/errors" - cc "github.com/projectatomic/libpod/pkg/spec" "github.com/sirupsen/logrus" ) diff --git a/cmd/podman/diff.go b/cmd/podman/diff.go index 9dca25050..f5a2d60ad 100644 --- a/cmd/podman/diff.go +++ b/cmd/podman/diff.go @@ -3,10 +3,10 @@ package main import ( "fmt" + "github.com/containers/libpod/cmd/podman/formats" + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/containers/storage/pkg/archive" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/formats" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/urfave/cli" ) diff --git a/cmd/podman/exec.go b/cmd/podman/exec.go index a42cdf63a..17a17f703 100644 --- a/cmd/podman/exec.go +++ b/cmd/podman/exec.go @@ -4,9 +4,9 @@ import ( "fmt" "strings" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) diff --git a/cmd/podman/export.go b/cmd/podman/export.go index 16c1f5c9b..20faac7d8 100644 --- a/cmd/podman/export.go +++ b/cmd/podman/export.go @@ -3,8 +3,8 @@ package main import ( "os" + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/formats/formats_test.go b/cmd/podman/formats/formats_test.go index fc7f01f93..c75109d65 100644 --- a/cmd/podman/formats/formats_test.go +++ b/cmd/podman/formats/formats_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/projectatomic/libpod/pkg/inspect" + "github.com/containers/libpod/pkg/inspect" ) func TestSetJSONFormatEncoder(t *testing.T) { diff --git a/cmd/podman/history.go b/cmd/podman/history.go index 2570dcc7d..2ae0dff66 100644 --- a/cmd/podman/history.go +++ b/cmd/podman/history.go @@ -6,11 +6,11 @@ import ( "strings" "time" + "github.com/containers/libpod/cmd/podman/formats" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod/image" units "github.com/docker/go-units" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/formats" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod/image" "github.com/urfave/cli" ) diff --git a/cmd/podman/images.go b/cmd/podman/images.go index 364c8a91c..024b6e240 100644 --- a/cmd/podman/images.go +++ b/cmd/podman/images.go @@ -9,13 +9,13 @@ import ( "github.com/sirupsen/logrus" + "github.com/containers/libpod/cmd/podman/formats" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" + "github.com/containers/libpod/libpod/image" "github.com/docker/go-units" digest "github.com/opencontainers/go-digest" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/formats" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" - "github.com/projectatomic/libpod/libpod/image" "github.com/urfave/cli" ) diff --git a/cmd/podman/import.go b/cmd/podman/import.go index 8a50d4fb9..4f7786c42 100644 --- a/cmd/podman/import.go +++ b/cmd/podman/import.go @@ -8,11 +8,11 @@ import ( "net/url" "os" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod/image" + "github.com/containers/libpod/pkg/util" "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod/image" - "github.com/projectatomic/libpod/pkg/util" "github.com/urfave/cli" ) diff --git a/cmd/podman/info.go b/cmd/podman/info.go index f03d23c5b..cd66943a4 100644 --- a/cmd/podman/info.go +++ b/cmd/podman/info.go @@ -3,10 +3,10 @@ package main import ( "runtime" + "github.com/containers/libpod/cmd/podman/formats" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/formats" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) diff --git a/cmd/podman/inspect.go b/cmd/podman/inspect.go index 6aaf9b694..a36f8c7a1 100644 --- a/cmd/podman/inspect.go +++ b/cmd/podman/inspect.go @@ -4,12 +4,12 @@ import ( "context" "strings" + "github.com/containers/libpod/cmd/podman/formats" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/cmd/podman/shared" + "github.com/containers/libpod/libpod" + "github.com/containers/libpod/pkg/util" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/batchcontainer" - "github.com/projectatomic/libpod/cmd/podman/formats" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" - "github.com/projectatomic/libpod/pkg/util" "github.com/urfave/cli" ) @@ -121,7 +121,7 @@ func iterateInput(ctx context.Context, c *cli.Context, args []string, runtime *l inspectError = errors.Wrapf(err, "error getting libpod container inspect data %q", ctr.ID) break } - data, err = batchcontainer.GetCtrInspectInfo(ctr, libpodInspectData) + data, err = shared.GetCtrInspectInfo(ctr, libpodInspectData) if err != nil { inspectError = errors.Wrapf(err, "error parsing container data %q", ctr.ID()) break @@ -156,7 +156,7 @@ func iterateInput(ctx context.Context, c *cli.Context, args []string, runtime *l inspectError = errors.Wrapf(err, "error getting libpod container inspect data %q", ctr.ID) break } - data, err = batchcontainer.GetCtrInspectInfo(ctr, libpodInspectData) + data, err = shared.GetCtrInspectInfo(ctr, libpodInspectData) if err != nil { inspectError = errors.Wrapf(err, "error parsing container data %q", ctr.ID) break diff --git a/cmd/podman/kill.go b/cmd/podman/kill.go index 99e111177..388c779f6 100644 --- a/cmd/podman/kill.go +++ b/cmd/podman/kill.go @@ -5,9 +5,9 @@ import ( "syscall" "fmt" + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/docker/docker/pkg/signal" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/urfave/cli" ) diff --git a/cmd/podman/libpodruntime/runtime.go b/cmd/podman/libpodruntime/runtime.go index f1f2b963c..e33b70e9a 100644 --- a/cmd/podman/libpodruntime/runtime.go +++ b/cmd/podman/libpodruntime/runtime.go @@ -5,10 +5,10 @@ import ( "os" "path/filepath" + "github.com/containers/libpod/libpod" + "github.com/containers/libpod/pkg/rootless" "github.com/containers/storage" "github.com/pkg/errors" - "github.com/projectatomic/libpod/libpod" - "github.com/projectatomic/libpod/pkg/rootless" "github.com/urfave/cli" ) diff --git a/cmd/podman/load.go b/cmd/podman/load.go index ffef9f6a6..fbc1f3cd0 100644 --- a/cmd/podman/load.go +++ b/cmd/podman/load.go @@ -9,9 +9,9 @@ import ( "github.com/containers/image/directory" dockerarchive "github.com/containers/image/docker/archive" ociarchive "github.com/containers/image/oci/archive" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod/image" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod/image" "github.com/urfave/cli" ) diff --git a/cmd/podman/login.go b/cmd/podman/login.go index 113760318..92417e1a1 100644 --- a/cmd/podman/login.go +++ b/cmd/podman/login.go @@ -9,8 +9,8 @@ import ( "github.com/containers/image/docker" "github.com/containers/image/pkg/docker/config" + "github.com/containers/libpod/libpod/common" "github.com/pkg/errors" - "github.com/projectatomic/libpod/libpod/common" "github.com/urfave/cli" "golang.org/x/crypto/ssh/terminal" ) diff --git a/cmd/podman/logout.go b/cmd/podman/logout.go index c06c69073..97631f827 100644 --- a/cmd/podman/logout.go +++ b/cmd/podman/logout.go @@ -4,8 +4,8 @@ import ( "fmt" "github.com/containers/image/pkg/docker/config" + "github.com/containers/libpod/libpod/common" "github.com/pkg/errors" - "github.com/projectatomic/libpod/libpod/common" "github.com/urfave/cli" ) diff --git a/cmd/podman/logs.go b/cmd/podman/logs.go index 26ca2330f..67ec038c3 100644 --- a/cmd/podman/logs.go +++ b/cmd/podman/logs.go @@ -8,9 +8,9 @@ import ( "time" "bufio" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/main.go b/cmd/podman/main.go index 7a669b3fe..e72998c8f 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -7,12 +7,12 @@ import ( "runtime/pprof" "syscall" + "github.com/containers/libpod/pkg/hooks" + _ "github.com/containers/libpod/pkg/hooks/0.1.0" + "github.com/containers/libpod/pkg/rootless" + "github.com/containers/libpod/version" "github.com/containers/storage/pkg/reexec" "github.com/pkg/errors" - "github.com/projectatomic/libpod/pkg/hooks" - _ "github.com/projectatomic/libpod/pkg/hooks/0.1.0" - "github.com/projectatomic/libpod/pkg/rootless" - "github.com/projectatomic/libpod/version" "github.com/sirupsen/logrus" lsyslog "github.com/sirupsen/logrus/hooks/syslog" "github.com/urfave/cli" diff --git a/cmd/podman/mount.go b/cmd/podman/mount.go index df1bacc5f..6cda9dbd3 100644 --- a/cmd/podman/mount.go +++ b/cmd/podman/mount.go @@ -4,9 +4,9 @@ import ( js "encoding/json" "fmt" + of "github.com/containers/libpod/cmd/podman/formats" + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/pkg/errors" - of "github.com/projectatomic/libpod/cmd/podman/formats" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/pause.go b/cmd/podman/pause.go index f97a1c61b..12ff747a7 100644 --- a/cmd/podman/pause.go +++ b/cmd/podman/pause.go @@ -4,8 +4,8 @@ import ( "fmt" "os" + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/urfave/cli" ) diff --git a/cmd/podman/pod_create.go b/cmd/podman/pod_create.go index c14496f5a..568ace6e7 100644 --- a/cmd/podman/pod_create.go +++ b/cmd/podman/pod_create.go @@ -4,9 +4,9 @@ import ( "fmt" "os" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/pod_inspect.go b/cmd/podman/pod_inspect.go index 6935335a6..1370c9471 100644 --- a/cmd/podman/pod_inspect.go +++ b/cmd/podman/pod_inspect.go @@ -4,9 +4,9 @@ import ( "encoding/json" "fmt" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) diff --git a/cmd/podman/pod_kill.go b/cmd/podman/pod_kill.go index 48f4eaa7a..3cd9bf7c9 100644 --- a/cmd/podman/pod_kill.go +++ b/cmd/podman/pod_kill.go @@ -4,9 +4,9 @@ import ( "fmt" "syscall" + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/docker/docker/pkg/signal" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/pod_pause.go b/cmd/podman/pod_pause.go index df51a037b..0e2e797f5 100644 --- a/cmd/podman/pod_pause.go +++ b/cmd/podman/pod_pause.go @@ -3,8 +3,8 @@ package main import ( "fmt" + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/pod_ps.go b/cmd/podman/pod_ps.go index 0f5c7a51d..20beae53a 100644 --- a/cmd/podman/pod_ps.go +++ b/cmd/podman/pod_ps.go @@ -7,13 +7,13 @@ import ( "strings" "time" + "github.com/containers/libpod/cmd/podman/formats" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/cmd/podman/shared" + "github.com/containers/libpod/libpod" + "github.com/containers/libpod/pkg/util" "github.com/docker/go-units" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/batchcontainer" - "github.com/projectatomic/libpod/cmd/podman/formats" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" - "github.com/projectatomic/libpod/pkg/util" "github.com/urfave/cli" ) @@ -28,7 +28,7 @@ const ( ) var ( - bc_opts batchcontainer.PsOptions + bc_opts shared.PsOptions ) type podPsCtrInfo struct { @@ -324,7 +324,7 @@ func generatePodFilterFuncs(filter, filterValue string, runtime *libpod.Runtime) return nil, errors.Errorf("%s is not a valid pod status", filterValue) } return func(p *libpod.Pod) bool { - status, err := getPodStatus(p) + status, err := shared.GetPodStatus(p) if err != nil { return false } @@ -460,52 +460,6 @@ func getPodTemplateOutput(psParams []podPsJSONParams, opts podPsOptions) ([]podP return psOutput, nil } -func getPodStatus(pod *libpod.Pod) (string, error) { - ctr_statuses, err := pod.Status() - if err != nil { - return ERROR, err - } - ctrNum := len(ctr_statuses) - if ctrNum == 0 { - return CREATED, nil - } - statuses := map[string]int{ - STOPPED: 0, - RUNNING: 0, - PAUSED: 0, - CREATED: 0, - ERROR: 0, - } - for _, ctr_status := range ctr_statuses { - switch ctr_status { - case libpod.ContainerStateStopped: - statuses[STOPPED]++ - case libpod.ContainerStateRunning: - statuses[RUNNING]++ - case libpod.ContainerStatePaused: - statuses[PAUSED]++ - case libpod.ContainerStateCreated, libpod.ContainerStateConfigured: - statuses[CREATED]++ - default: - statuses[ERROR]++ - } - } - - if statuses[RUNNING] > 0 { - return RUNNING, nil - } else if statuses[PAUSED] == ctrNum { - return PAUSED, nil - } else if statuses[STOPPED] == ctrNum { - return EXITED, nil - } else if statuses[STOPPED] > 0 { - return STOPPED, nil - } else if statuses[ERROR] > 0 { - return ERROR, nil - } else { - return CREATED, nil - } -} - // getAndSortPodJSONOutput returns the container info in its raw, sorted form func getAndSortPodJSONParams(pods []*libpod.Pod, opts podPsOptions, runtime *libpod.Runtime) ([]podPsJSONParams, error) { var ( @@ -519,13 +473,13 @@ func getAndSortPodJSONParams(pods []*libpod.Pod, opts podPsOptions, runtime *lib return nil, err } ctrNum := len(ctrs) - status, err := getPodStatus(pod) + status, err := shared.GetPodStatus(pod) if err != nil { return nil, err } for _, ctr := range ctrs { - batchInfo, err := batchcontainer.BatchContainerOp(ctr, bc_opts) + batchInfo, err := shared.BatchContainerOp(ctr, bc_opts) if err != nil { return nil, err } diff --git a/cmd/podman/pod_restart.go b/cmd/podman/pod_restart.go index fe802fc9d..62e93b316 100644 --- a/cmd/podman/pod_restart.go +++ b/cmd/podman/pod_restart.go @@ -3,8 +3,8 @@ package main import ( "fmt" + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/pod_rm.go b/cmd/podman/pod_rm.go index 983203374..549fa0290 100644 --- a/cmd/podman/pod_rm.go +++ b/cmd/podman/pod_rm.go @@ -3,8 +3,8 @@ package main import ( "fmt" + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/pod_start.go b/cmd/podman/pod_start.go index e35ec7993..b6ba5719b 100644 --- a/cmd/podman/pod_start.go +++ b/cmd/podman/pod_start.go @@ -3,8 +3,8 @@ package main import ( "fmt" + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/pod_stop.go b/cmd/podman/pod_stop.go index 97d248b30..ac6781408 100644 --- a/cmd/podman/pod_stop.go +++ b/cmd/podman/pod_stop.go @@ -3,8 +3,8 @@ package main import ( "fmt" + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/pod_unpause.go b/cmd/podman/pod_unpause.go index 5dd5c79e4..d599baba9 100644 --- a/cmd/podman/pod_unpause.go +++ b/cmd/podman/pod_unpause.go @@ -3,8 +3,8 @@ package main import ( "fmt" + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/port.go b/cmd/podman/port.go index 9082ec25d..e3933f925 100644 --- a/cmd/podman/port.go +++ b/cmd/podman/port.go @@ -5,9 +5,9 @@ import ( "strconv" "strings" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go index a5f862f8f..0ad511217 100644 --- a/cmd/podman/ps.go +++ b/cmd/podman/ps.go @@ -8,14 +8,14 @@ import ( "strings" "time" + "github.com/containers/libpod/cmd/podman/formats" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/cmd/podman/shared" + "github.com/containers/libpod/libpod" + "github.com/containers/libpod/pkg/util" "github.com/cri-o/ocicni/pkg/ocicni" "github.com/docker/go-units" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/batchcontainer" - "github.com/projectatomic/libpod/cmd/podman/formats" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" - "github.com/projectatomic/libpod/pkg/util" "github.com/sirupsen/logrus" "github.com/urfave/cli" "k8s.io/apimachinery/pkg/fields" @@ -52,25 +52,25 @@ type psTemplateParams struct { // psJSONParams will be populated by data from libpod.Container, // the members of the struct are the sama data types as their sources. type psJSONParams struct { - ID string `json:"id"` - Image string `json:"image"` - ImageID string `json:"image_id"` - Command []string `json:"command"` - ExitCode int32 `json:"exitCode"` - Exited bool `json:"exited"` - CreatedAt time.Time `json:"createdAt"` - StartedAt time.Time `json:"startedAt"` - ExitedAt time.Time `json:"exitedAt"` - Status string `json:"status"` - PID int `json:"PID"` - Ports []ocicni.PortMapping `json:"ports"` - Size *batchcontainer.ContainerSize `json:"size,omitempty"` - Names string `json:"names"` - Labels fields.Set `json:"labels"` - Mounts []string `json:"mounts"` - ContainerRunning bool `json:"ctrRunning"` - Namespaces *batchcontainer.Namespace `json:"namespace,omitempty"` - Pod string `json:"pod,omitempty"` + ID string `json:"id"` + Image string `json:"image"` + ImageID string `json:"image_id"` + Command []string `json:"command"` + ExitCode int32 `json:"exitCode"` + Exited bool `json:"exited"` + CreatedAt time.Time `json:"createdAt"` + StartedAt time.Time `json:"startedAt"` + ExitedAt time.Time `json:"exitedAt"` + Status string `json:"status"` + PID int `json:"PID"` + Ports []ocicni.PortMapping `json:"ports"` + Size *shared.ContainerSize `json:"size,omitempty"` + Names string `json:"names"` + Labels fields.Set `json:"labels"` + Mounts []string `json:"mounts"` + ContainerRunning bool `json:"ctrRunning"` + Namespaces *shared.Namespace `json:"namespace,omitempty"` + Pod string `json:"pod,omitempty"` } // Type declaration and functions for sorting the PS output @@ -218,7 +218,7 @@ func psCmd(c *cli.Context) error { format := genPsFormat(c.String("format"), c.Bool("quiet"), c.Bool("size"), c.Bool("namespace"), c.Bool("pod")) - opts := batchcontainer.PsOptions{ + opts := shared.PsOptions{ All: c.Bool("all"), Filter: c.String("filter"), Format: format, @@ -497,11 +497,11 @@ func sortPsOutput(sortBy string, psOutput psSorted) (psSorted, error) { } // getTemplateOutput returns the modified container information -func getTemplateOutput(psParams []psJSONParams, opts batchcontainer.PsOptions) ([]psTemplateParams, error) { +func getTemplateOutput(psParams []psJSONParams, opts shared.PsOptions) ([]psTemplateParams, error) { var ( psOutput []psTemplateParams pod, status, size string - ns *batchcontainer.Namespace + ns *shared.Namespace ) // If the user is trying to filter based on size, or opted to sort on size // the size bool must be set. @@ -589,13 +589,13 @@ func getTemplateOutput(psParams []psJSONParams, opts batchcontainer.PsOptions) ( } // getAndSortJSONOutput returns the container info in its raw, sorted form -func getAndSortJSONParams(containers []*libpod.Container, opts batchcontainer.PsOptions) ([]psJSONParams, error) { +func getAndSortJSONParams(containers []*libpod.Container, opts shared.PsOptions) ([]psJSONParams, error) { var ( psOutput psSorted - ns *batchcontainer.Namespace + ns *shared.Namespace ) for _, ctr := range containers { - batchInfo, err := batchcontainer.BatchContainerOp(ctr, opts) + batchInfo, err := shared.BatchContainerOp(ctr, opts) if err != nil { if errors.Cause(err) == libpod.ErrNoSuchCtr { logrus.Warn(err) @@ -605,7 +605,7 @@ func getAndSortJSONParams(containers []*libpod.Container, opts batchcontainer.Ps } if opts.Namespace { - ns = batchcontainer.GetNamespaces(batchInfo.Pid) + ns = shared.GetNamespaces(batchInfo.Pid) } params := psJSONParams{ ID: ctr.ID(), @@ -634,7 +634,7 @@ func getAndSortJSONParams(containers []*libpod.Container, opts batchcontainer.Ps return sortPsOutput(opts.Sort, psOutput) } -func generatePsOutput(containers []*libpod.Container, opts batchcontainer.PsOptions) error { +func generatePsOutput(containers []*libpod.Container, opts shared.PsOptions) error { if len(containers) == 0 && opts.Format != formats.JSONString { return nil } diff --git a/cmd/podman/pull.go b/cmd/podman/pull.go index a1d685735..f1666113b 100644 --- a/cmd/podman/pull.go +++ b/cmd/podman/pull.go @@ -9,10 +9,10 @@ import ( dockerarchive "github.com/containers/image/docker/archive" "github.com/containers/image/transports/alltransports" "github.com/containers/image/types" + "github.com/containers/libpod/cmd/podman/libpodruntime" + image2 "github.com/containers/libpod/libpod/image" + "github.com/containers/libpod/pkg/util" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - image2 "github.com/projectatomic/libpod/libpod/image" - "github.com/projectatomic/libpod/pkg/util" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/push.go b/cmd/podman/push.go index 3c2e59e58..79758257a 100644 --- a/cmd/podman/push.go +++ b/cmd/podman/push.go @@ -9,11 +9,11 @@ import ( "github.com/containers/image/directory" "github.com/containers/image/manifest" "github.com/containers/image/types" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod/image" + "github.com/containers/libpod/pkg/util" imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod/image" - "github.com/projectatomic/libpod/pkg/util" "github.com/urfave/cli" ) diff --git a/cmd/podman/refresh.go b/cmd/podman/refresh.go index 8a1cee717..8e4fd9ae9 100644 --- a/cmd/podman/refresh.go +++ b/cmd/podman/refresh.go @@ -4,8 +4,8 @@ import ( "fmt" "os" + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/urfave/cli" ) diff --git a/cmd/podman/restart.go b/cmd/podman/restart.go index 08e8b615b..89484f895 100644 --- a/cmd/podman/restart.go +++ b/cmd/podman/restart.go @@ -5,9 +5,9 @@ import ( "fmt" "os" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go index c0ec7d9f6..1d580ac7e 100644 --- a/cmd/podman/rm.go +++ b/cmd/podman/rm.go @@ -4,9 +4,9 @@ import ( "fmt" "os" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) diff --git a/cmd/podman/rmi.go b/cmd/podman/rmi.go index 95e98a038..c1c3869c8 100644 --- a/cmd/podman/rmi.go +++ b/cmd/podman/rmi.go @@ -4,10 +4,10 @@ import ( "fmt" "os" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod/image" "github.com/containers/storage" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod/image" "github.com/urfave/cli" ) @@ -97,7 +97,7 @@ func rmiCmd(c *cli.Context) error { // Note that we have to query the storage one-by-one to // always get the latest state for each image. Otherwise, we // run inconsistency issues, for instance, with repoTags. - // See https://github.com/projectatomic/libpod/issues/930 as + // See https://github.com/containers/libpod/issues/930 as // an exemplary inconsistency issue. for _, i := range images { newImage, err := runtime.ImageRuntime().NewFromLocal(i) diff --git a/cmd/podman/run.go b/cmd/podman/run.go index efc7f2dd0..997068a55 100644 --- a/cmd/podman/run.go +++ b/cmd/podman/run.go @@ -9,13 +9,13 @@ import ( "strconv" "strings" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" + "github.com/containers/libpod/libpod/image" + "github.com/containers/libpod/pkg/inspect" + cc "github.com/containers/libpod/pkg/spec" + "github.com/containers/libpod/pkg/util" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" - "github.com/projectatomic/libpod/libpod/image" - "github.com/projectatomic/libpod/pkg/inspect" - cc "github.com/projectatomic/libpod/pkg/spec" - "github.com/projectatomic/libpod/pkg/util" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/run_test.go b/cmd/podman/run_test.go index a421c4a20..397b3bb71 100644 --- a/cmd/podman/run_test.go +++ b/cmd/podman/run_test.go @@ -4,11 +4,11 @@ import ( "runtime" "testing" + "github.com/containers/libpod/pkg/inspect" + cc "github.com/containers/libpod/pkg/spec" units "github.com/docker/go-units" ociv1 "github.com/opencontainers/image-spec/specs-go/v1" spec "github.com/opencontainers/runtime-spec/specs-go" - "github.com/projectatomic/libpod/pkg/inspect" - cc "github.com/projectatomic/libpod/pkg/spec" "github.com/stretchr/testify/assert" "github.com/urfave/cli" ) diff --git a/cmd/podman/save.go b/cmd/podman/save.go index f5fd421a4..8186718d4 100644 --- a/cmd/podman/save.go +++ b/cmd/podman/save.go @@ -12,10 +12,10 @@ import ( "github.com/containers/image/manifest" ociarchive "github.com/containers/image/oci/archive" "github.com/containers/image/types" + "github.com/containers/libpod/cmd/podman/libpodruntime" + libpodImage "github.com/containers/libpod/libpod/image" imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - libpodImage "github.com/projectatomic/libpod/libpod/image" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/search.go b/cmd/podman/search.go index d71432fc6..cc18cd1de 100644 --- a/cmd/podman/search.go +++ b/cmd/podman/search.go @@ -7,12 +7,12 @@ import ( "strings" "github.com/containers/image/docker" + "github.com/containers/libpod/cmd/podman/formats" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod/common" + sysreg "github.com/containers/libpod/pkg/registries" "github.com/docker/distribution/reference" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/formats" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod/common" - sysreg "github.com/projectatomic/libpod/pkg/registries" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/batchcontainer/container.go b/cmd/podman/shared/container.go index e27914174..7a5455046 100644 --- a/cmd/podman/batchcontainer/container.go +++ b/cmd/podman/shared/container.go @@ -1,4 +1,4 @@ -package batchcontainer +package shared import ( "encoding/json" @@ -9,11 +9,11 @@ import ( "strings" "time" + "github.com/containers/libpod/libpod" + "github.com/containers/libpod/pkg/inspect" + cc "github.com/containers/libpod/pkg/spec" "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" - "github.com/projectatomic/libpod/libpod" - "github.com/projectatomic/libpod/pkg/inspect" - cc "github.com/projectatomic/libpod/pkg/spec" "github.com/sirupsen/logrus" ) diff --git a/cmd/podman/shared/pod.go b/cmd/podman/shared/pod.go new file mode 100644 index 000000000..c660bcf9e --- /dev/null +++ b/cmd/podman/shared/pod.go @@ -0,0 +1,62 @@ +package shared + +import ( + "github.com/containers/libpod/libpod" +) + +const ( + stopped = "Stopped" + running = "Running" + paused = "Paused" + exited = "Exited" + errored = "Error" + created = "Created" +) + +// GetPodStatus determines the status of the pod based on the +// statuses of the containers in the pod. +// Returns a string representation of the pod status +func GetPodStatus(pod *libpod.Pod) (string, error) { + ctrStatuses, err := pod.Status() + if err != nil { + return errored, err + } + ctrNum := len(ctrStatuses) + if ctrNum == 0 { + return created, nil + } + statuses := map[string]int{ + stopped: 0, + running: 0, + paused: 0, + created: 0, + errored: 0, + } + for _, ctrStatus := range ctrStatuses { + switch ctrStatus { + case libpod.ContainerStateStopped: + statuses[stopped]++ + case libpod.ContainerStateRunning: + statuses[running]++ + case libpod.ContainerStatePaused: + statuses[paused]++ + case libpod.ContainerStateCreated, libpod.ContainerStateConfigured: + statuses[created]++ + default: + statuses[errored]++ + } + } + + if statuses[running] > 0 { + return running, nil + } else if statuses[paused] == ctrNum { + return paused, nil + } else if statuses[stopped] == ctrNum { + return exited, nil + } else if statuses[stopped] > 0 { + return stopped, nil + } else if statuses[errored] > 0 { + return errored, nil + } + return created, nil +} diff --git a/cmd/podman/sigproxy.go b/cmd/podman/sigproxy.go index 388e23439..16861bad0 100644 --- a/cmd/podman/sigproxy.go +++ b/cmd/podman/sigproxy.go @@ -4,8 +4,8 @@ import ( "os" "syscall" + "github.com/containers/libpod/libpod" "github.com/docker/docker/pkg/signal" - "github.com/projectatomic/libpod/libpod" "github.com/sirupsen/logrus" ) diff --git a/cmd/podman/start.go b/cmd/podman/start.go index 3dde306d7..f0f205892 100644 --- a/cmd/podman/start.go +++ b/cmd/podman/start.go @@ -4,9 +4,9 @@ import ( "fmt" "os" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/stats.go b/cmd/podman/stats.go index d1015801f..cb89b8a9d 100644 --- a/cmd/podman/stats.go +++ b/cmd/podman/stats.go @@ -7,11 +7,11 @@ import ( "time" tm "github.com/buger/goterm" + "github.com/containers/libpod/cmd/podman/formats" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" "github.com/docker/go-units" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/formats" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) diff --git a/cmd/podman/stop.go b/cmd/podman/stop.go index 820d1acb2..d1fae56dd 100644 --- a/cmd/podman/stop.go +++ b/cmd/podman/stop.go @@ -4,9 +4,9 @@ import ( "fmt" "os" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) diff --git a/cmd/podman/tag.go b/cmd/podman/tag.go index d1d1693a3..5c81fe7f8 100644 --- a/cmd/podman/tag.go +++ b/cmd/podman/tag.go @@ -1,8 +1,8 @@ package main import ( + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/urfave/cli" ) diff --git a/cmd/podman/top.go b/cmd/podman/top.go index ab29df3ab..43728893c 100644 --- a/cmd/podman/top.go +++ b/cmd/podman/top.go @@ -6,9 +6,9 @@ import ( "strings" "text/tabwriter" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) @@ -85,8 +85,9 @@ func topCmd(c *cli.Context) error { } if err != nil { - return errors.Wrapf(err, "unable to lookup %s", args[0]) + return errors.Wrapf(err, "unable to lookup requested container") } + conStat, err := container.State() if err != nil { return errors.Wrapf(err, "unable to look up state for %s", args[0]) diff --git a/cmd/podman/umount.go b/cmd/podman/umount.go index 1e364b48f..33556b2ea 100644 --- a/cmd/podman/umount.go +++ b/cmd/podman/umount.go @@ -3,10 +3,10 @@ package main import ( "fmt" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/libpod" "github.com/containers/storage" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) diff --git a/cmd/podman/unpause.go b/cmd/podman/unpause.go index 6571dff4e..d0c622b8a 100644 --- a/cmd/podman/unpause.go +++ b/cmd/podman/unpause.go @@ -4,8 +4,8 @@ import ( "fmt" "os" + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/urfave/cli" ) diff --git a/cmd/podman/utils.go b/cmd/podman/utils.go index 2d19e312c..89ec48dbe 100644 --- a/cmd/podman/utils.go +++ b/cmd/podman/utils.go @@ -6,10 +6,10 @@ import ( "os" gosignal "os/signal" + "github.com/containers/libpod/libpod" "github.com/docker/docker/pkg/signal" "github.com/docker/docker/pkg/term" "github.com/pkg/errors" - "github.com/projectatomic/libpod/libpod" "github.com/sirupsen/logrus" "github.com/urfave/cli" "golang.org/x/crypto/ssh/terminal" diff --git a/cmd/podman/varlink.go b/cmd/podman/varlink.go index 71cf86c74..4e6d76c7e 100644 --- a/cmd/podman/varlink.go +++ b/cmd/podman/varlink.go @@ -5,11 +5,11 @@ package main import ( "time" + "github.com/containers/libpod/cmd/podman/libpodruntime" + iopodman "github.com/containers/libpod/cmd/podman/varlink" + "github.com/containers/libpod/pkg/varlinkapi" + "github.com/containers/libpod/version" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - iopodman "github.com/projectatomic/libpod/cmd/podman/varlink" - "github.com/projectatomic/libpod/pkg/varlinkapi" - "github.com/projectatomic/libpod/version" "github.com/sirupsen/logrus" "github.com/urfave/cli" "github.com/varlink/go/varlink" @@ -59,7 +59,7 @@ func varlinkCmd(c *cli.Context) error { "Atomic", "podman", version.Version, - "https://github.com/projectatomic/libpod", + "https://github.com/containers/libpod", ) if err != nil { return errors.Wrapf(err, "unable to create new varlink service") diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink index 336600b2f..3d4a8fa84 100644 --- a/cmd/podman/varlink/io.podman.varlink +++ b/cmd/podman/varlink/io.podman.varlink @@ -1,5 +1,5 @@ # Podman Service Interface and API description. The master version of this document can be found -# in the [API.md](https://github.com/projectatomic/libpod/blob/master/API.md) file in the upstream libpod repository. +# in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in the upstream libpod repository. interface io.podman @@ -334,6 +334,13 @@ type ListPodContainerInfo ( status: string ) +# PodCreate is an input structure for creating pods. +type PodCreate ( + name: string, + cgroupParent: string, + labels: [string]string +) + # ListPodData is the returned struct for an individual pod type ListPodData ( id: string, @@ -346,6 +353,11 @@ type ListPodData ( containersinfo: []ListPodContainerInfo ) +type PodContainerErrorData ( + containerid: string, + reason: string +) + # Ping provides a response for developers to ensure their varlink setup is working. # #### Example # ~~~ @@ -605,7 +617,7 @@ method DeleteUnusedImages() -> (images: []string) # container while it is being committed, pass a _true_ bool for the pause argument. If the container cannot # be found by the ID or name provided, a (ContainerNotFound)[#ContainerNotFound] error will be returned; otherwise, # the resulting image's ID will be returned as a string. -method Commit(name: string, image_name: string, changes: []string, author: string, message: string, pause: bool) -> (image: string) +method Commit(name: string, image_name: string, changes: []string, author: string, message: string, pause: bool, manifestType: string) -> (image: string) # ImportImage imports an image from a source (like tarball) into local storage. The image can have additional # descriptions added to it using the message and changes options. See also [ExportImage](ExportImage). @@ -629,114 +641,115 @@ method ExportImage(name: string, destination: string, compress: bool, tags: []st # ~~~ method PullImage(name: string) -> (id: string) -# CreatePod creates a new empty pod. It takes name and cgroup_parent args as strings, and a labels map +# CreatePod creates a new empty pod. It uses a [PodCreate](#PodCreate) type for input. # On success, the ID of the newly created pod will be returned. # #### Example # ~~~ -# $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"name": "test"}' +# $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"create": {"name": "test"}}' # { -# "pod": "8759dafbc0a4dc3bcfb57eeb72e4331eb73c5cc09ab968e65ce45b9ad5c4b6bb" +# "pod": "b05dee7bd4ccfee688099fe1588a7a898d6ddd6897de9251d4671c9b0feacb2a" # } +# # ~~~ -method CreatePod() -> (notimplemented: NotImplemented) +method CreatePod(create: PodCreate) -> (pod: string) # ListPods returns a list of pods in no particular order. They are # returned as an array of ListPodData structs. See also [GetPod](#GetPod). -method ListPods() -> (notimplemented: NotImplemented) +method ListPods() -> (pods: []ListPodData) # GetPod takes a name or ID of a pod and returns single [ListPodData](#ListPodData) # structure. A [PodNotFound](#PodNotFound) error will be returned if the pod cannot be found. # See also [ListPods](ListPods). -method GetPod() -> (notimplemented: NotImplemented) +method GetPod(name: string) -> (pod: ListPodData) # InspectPod takes the name or ID of an image and returns a string respresentation of data associated with the # pod. You must serialize the string into JSON to use it further. A [PodNotFound](#PodNotFound) error will # be returned if the pod cannot be found. -method InspectPod() -> (notimplemented: NotImplemented) +method InspectPod(name: string) -> (pod: string) # StartPod starts containers in a pod. It takes the name or ID of pod. If the pod cannot be found, a [PodNotFound](#PodNotFound) -# error will be returned. If the pod has no containers, a [PodNoContainers](#PodNoContainers) error will be returned. -# Containers in a pod are started independently. If there is an error starting one container, the ID of those containers -# will be returned in a list of [PodContainerError](#PodContainerError). The ID of the pod is returned if any containers were started. +# error will be returned. Containers in a pod are started independently. If there is an error starting one container, the ID of those containers +# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). +# If the pod was started with no errors, the pod ID is returned. # See also [CreatePod](#CreatePod). # #### Example # ~~~ # $ varlink call -m unix:/run/podman/io.podman/io.podman.StartPod '{"name": "135d71b9495f"}' # { # "pod": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6", -# "error": [] # } # ~~~ -method StartPod() -> (notimplemented: NotImplemented) +method StartPod(name: string) -> (pod: string) # StopPod stops containers in a pod. It takes the name or ID of a pod. # If the pod cannot be found, a [PodNotFound](#PodNotFound) error will be returned instead. # Containers in a pod are stopped independently. If there is an error stopping one container, the ID of those containers -# will be returned in a list of [PodContainerError](#PodContainerError). The ID of the pod is returned if any containers were stopped. +# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). +# If the pod was stopped with no errors, the pod ID is returned. # See also [KillPod](KillPod). # #### Example # ~~~ # $ varlink call -m unix:/run/podman/io.podman/io.podman.StopPod '{"name": "135d71b9495f"}' # { # "pod": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" -# "error": [] # } # ~~~ -method StopPod() -> (notimplemented: NotImplemented) +method StopPod(name: string) -> (pod: string) # RestartPod will restart containers in a pod given a pod name or ID. Containers in # the pod that are running will be stopped, then all stopped containers will be run. -# If the pod cannot be found by name or ID, a [PodNotFound](#PodNotFound) error will be -# returned. If the pod has no containers, a [PodNoContainers](#PodNoContainers) -# error will be returned. +# If the pod cannot be found by name or ID, a [PodNotFound](#PodNotFound) error will be returned. # Containers in a pod are restarted independently. If there is an error restarting one container, the ID of those containers -# will be returned in a list of [PodContainerError](#PodContainerError). The ID of the pod is returned if any containers were restarted. +# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). +# If the pod was restarted with no errors, the pod ID is returned. # #### Example # ~~~ # $ varlink call -m unix:/run/podman/io.podman/io.podman.RestartPod '{"name": "135d71b9495f"}' # { # "pod": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" -# "error": [] # } # ~~~ -method RestartPod() -> (notimplemented: NotImplemented) +method RestartPod(name: string) -> (pod: string) # KillPod takes the name or ID of a pod as well as a signal to be applied to the pod. If the pod cannot be found, a # [PodNotFound](#PodNotFound) error is returned. # Containers in a pod are killed independently. If there is an error killing one container, the ID of those containers -# will be returned in a list of [PodContainerError](#PodContainerError). The ID of the pod is returned if any containers were killed. +# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). +# If the pod was killed with no errors, the pod ID is returned. # See also [StopPod](StopPod). -method KillPod() -> (notimplemented: NotImplemented) +method KillPod(name: string, signal: int) -> (pod: string) # PausePod takes the name or ID of a pod and pauses the running containers associated with it. If the pod cannot be found, # a [PodNotFound](#PodNotFound) error will be returned. # Containers in a pod are paused independently. If there is an error pausing one container, the ID of those containers -# will be returned in a list of [PodContainerError](#PodContainerError). The ID of the pod is returned if any containers were paused. +# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). +# If the pod was paused with no errors, the pod ID is returned. # See also [UnpausePod](#UnpausePod). -method PausePod() -> (notimplemented: NotImplemented) +method PausePod(name: string) -> (pod: string) # UnpausePod takes the name or ID of a pod and unpauses the paused containers associated with it. If the pod cannot be # found, a [PodNotFound](#PodNotFound) error will be returned. -# Containers in a pod are unpaused independently. If there is an error pausing one container, the ID of those containers -# will be returned in a list of [PodContainerError](#PodContainerError). The ID of the pod is returned if any containers were unpaused. +# Containers in a pod are unpaused independently. If there is an error unpausing one container, the ID of those containers +# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). +# If the pod was unpaused with no errors, the pod ID is returned. # See also [PausePod](#PausePod). -method UnpausePod() -> (notimplemented: NotImplemented) +method UnpausePod(name: string) -> (pod: string) # RemovePod takes the name or ID of a pod as well a boolean representing whether a running # container in the pod can be stopped and removed. If a pod has containers associated with it, and force is not true, -# a [PodHasContainer](#PodHasContainer) error will be returned. +# an error will occur. # If the pod cannot be found by name or ID, a [PodNotFound](#PodNotFound) error will be returned. # Containers in a pod are removed independently. If there is an error removing any container, the ID of those containers -# will be returned in a list of [PodContainerError](#PodContainerError). The ID of the pod is returned if any containers were removed. +# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). +# If the pod was removed with no errors, the pod ID is returned. # #### Example # ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.RemovePod '{"name": "62f4fd98cb57"}' +# $ varlink call -m unix:/run/podman/io.podman/io.podman.RemovePod '{"name": "62f4fd98cb57", "force": "true"}' # { # "pod": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" -# "error": [] # } # ~~~ -method RemovePod() -> (notimplemented: NotImplemented) +method RemovePod(name: string, force: bool) -> (pod: string) # This method has not be implemented yet. method WaitPod() -> (notimplemented: NotImplemented) @@ -756,15 +769,9 @@ error ContainerNotFound (name: string) # PodNotFound means the pod could not be found by the provided name or ID in local storage. error PodNotFound (name: string) -# PodNoContainers means the pod does not have any containers associated and cannot be started or restarted. -error PodNoContainers (name: string) - -# PodHasContainers means the pod has containers associated and cannot be stopped without the force boolean set as true. -error PodHasContainers (name: string) - # PodContainerError means a container associated with a pod failed to preform an operation. It contains # a container ID of the container that failed. -error PodContainerError (names: string) +error PodContainerError (podname: string, errors: []PodContainerErrorData) # ErrorOccurred is a generic error for an error that occurs during the execution. The actual error message # is includes as part of the error's text. diff --git a/cmd/podman/version.go b/cmd/podman/version.go index 952cf32d3..f896229c4 100644 --- a/cmd/podman/version.go +++ b/cmd/podman/version.go @@ -4,8 +4,8 @@ import ( "fmt" "time" + "github.com/containers/libpod/libpod" "github.com/pkg/errors" - "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) diff --git a/cmd/podman/wait.go b/cmd/podman/wait.go index 142e0e599..929b66761 100644 --- a/cmd/podman/wait.go +++ b/cmd/podman/wait.go @@ -4,8 +4,8 @@ import ( "fmt" "os" + "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/urfave/cli" ) |