diff options
55 files changed, 1221 insertions, 642 deletions
@@ -247,10 +247,10 @@ install.tools: .install.gitvalidation .install.gometalinter .install.md2man make all install; \ fi -varlink_generate: .gopathok cmd/podman/ioprojectatomicpodman/ioprojectatomicpodman.go +varlink_generate: .gopathok cmd/podman/varlink/ioprojectatomicpodman.go -cmd/podman/ioprojectatomicpodman/ioprojectatomicpodman.go: cmd/podman/ioprojectatomicpodman/io.projectatomic.podman.varlink - $(GO) generate ./cmd/podman/ioprojectatomicpodman/... +cmd/podman/varlink/ioprojectatomicpodman.go: cmd/podman/varlink/io.projectatomic.podman.varlink + $(GO) generate ./cmd/podman/varlink/... validate: gofmt .gitvalidation diff --git a/cmd/podman/attach.go b/cmd/podman/attach.go index 041cc0388..7cbf9ca86 100644 --- a/cmd/podman/attach.go +++ b/cmd/podman/attach.go @@ -4,6 +4,7 @@ import ( "os" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) @@ -45,7 +46,7 @@ func attachCmd(c *cli.Context) error { return errors.Errorf("attach requires the name or id of one running container or the latest flag") } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "error creating libpod runtime") } diff --git a/cmd/podman/commit.go b/cmd/podman/commit.go index ef45a9f05..c721c8700 100644 --- a/cmd/podman/commit.go +++ b/cmd/podman/commit.go @@ -7,6 +7,7 @@ import ( "strings" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/projectatomic/libpod/libpod" "github.com/projectatomic/libpod/libpod/buildah" "github.com/projectatomic/libpod/libpod/image" @@ -55,7 +56,7 @@ func commitCmd(c *cli.Context) error { if err := validateFlags(c, commitFlags); err != nil { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/create.go b/cmd/podman/create.go index 930f90483..856fbfa83 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -15,6 +15,7 @@ import ( "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" "github.com/projectatomic/libpod/pkg/inspect" @@ -173,7 +174,7 @@ func createCmd(c *cli.Context) error { return errors.Errorf("image name or ID is required") } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "error creating libpod runtime") } diff --git a/cmd/podman/diff.go b/cmd/podman/diff.go index a3ca9ae50..9dca25050 100644 --- a/cmd/podman/diff.go +++ b/cmd/podman/diff.go @@ -6,6 +6,7 @@ import ( "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" ) @@ -82,7 +83,7 @@ func diffCmd(c *cli.Context) error { return errors.Errorf("container, image, or layer name must be specified: podman diff [options [...]] ID-NAME") } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/exec.go b/cmd/podman/exec.go index c72f63ac8..a42cdf63a 100644 --- a/cmd/podman/exec.go +++ b/cmd/podman/exec.go @@ -5,6 +5,7 @@ import ( "strings" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) @@ -66,7 +67,7 @@ func execCmd(c *cli.Context) error { argStart = 0 } cmd := args[argStart:] - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "error creating libpod runtime") } diff --git a/cmd/podman/export.go b/cmd/podman/export.go index 9b498562e..eaf1ab39f 100644 --- a/cmd/podman/export.go +++ b/cmd/podman/export.go @@ -4,6 +4,7 @@ import ( "os" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) @@ -34,7 +35,7 @@ func exportCmd(c *cli.Context) error { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/history.go b/cmd/podman/history.go index 51ad0edcb..4f3867d34 100644 --- a/cmd/podman/history.go +++ b/cmd/podman/history.go @@ -11,6 +11,7 @@ import ( "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "github.com/projectatomic/libpod/cmd/podman/formats" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/urfave/cli" ) @@ -83,7 +84,7 @@ func historyCmd(c *cli.Context) error { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/images.go b/cmd/podman/images.go index 076c5956d..305d2f11e 100644 --- a/cmd/podman/images.go +++ b/cmd/podman/images.go @@ -10,6 +10,7 @@ import ( 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" @@ -90,7 +91,7 @@ func imagesCmd(c *cli.Context) error { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "Could not get runtime") } diff --git a/cmd/podman/import.go b/cmd/podman/import.go index f57d70af0..5a4fa45d9 100644 --- a/cmd/podman/import.go +++ b/cmd/podman/import.go @@ -7,11 +7,12 @@ import ( "net/http" "net/url" "os" - "strings" "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" ) @@ -49,7 +50,7 @@ func importCmd(c *cli.Context) error { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } @@ -76,7 +77,7 @@ func importCmd(c *cli.Context) error { changes := v1.ImageConfig{} if c.IsSet("change") { - changes, err = getImageConfig(c.StringSlice("change")) + changes, err = util.GetImageConfig(c.StringSlice("change")) if err != nil { return errors.Wrapf(err, "error adding config changes to image %q", source) } @@ -138,68 +139,3 @@ func downloadFromURL(source string) (string, error) { return outFile.Name(), nil } - -// getImageConfig converts the --change flag values in the format "CMD=/bin/bash USER=example" -// to a type v1.ImageConfig -func getImageConfig(changes []string) (v1.ImageConfig, error) { - // USER=value | EXPOSE=value | ENV=value | ENTRYPOINT=value | - // CMD=value | VOLUME=value | WORKDIR=value | LABEL=key=value | STOPSIGNAL=value - - var ( - user string - env []string - entrypoint []string - cmd []string - workingDir string - stopSignal string - ) - - exposedPorts := make(map[string]struct{}) - volumes := make(map[string]struct{}) - labels := make(map[string]string) - - for _, ch := range changes { - pair := strings.Split(ch, "=") - if len(pair) == 1 { - return v1.ImageConfig{}, errors.Errorf("no value given for instruction %q", ch) - } - switch pair[0] { - case "USER": - user = pair[1] - case "EXPOSE": - var st struct{} - exposedPorts[pair[1]] = st - case "ENV": - env = append(env, pair[1]) - case "ENTRYPOINT": - entrypoint = append(entrypoint, pair[1]) - case "CMD": - cmd = append(cmd, pair[1]) - case "VOLUME": - var st struct{} - volumes[pair[1]] = st - case "WORKDIR": - workingDir = pair[1] - case "LABEL": - if len(pair) == 3 { - labels[pair[1]] = pair[2] - } else { - labels[pair[1]] = "" - } - case "STOPSIGNAL": - stopSignal = pair[1] - } - } - - return v1.ImageConfig{ - User: user, - ExposedPorts: exposedPorts, - Env: env, - Entrypoint: entrypoint, - Cmd: cmd, - Volumes: volumes, - WorkingDir: workingDir, - Labels: labels, - StopSignal: stopSignal, - }, nil -} diff --git a/cmd/podman/info.go b/cmd/podman/info.go index 1c4ba2515..d9bbebcdf 100644 --- a/cmd/podman/info.go +++ b/cmd/podman/info.go @@ -5,6 +5,7 @@ import ( "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" ) @@ -37,7 +38,7 @@ func infoCmd(c *cli.Context) error { } info := map[string]interface{}{} - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/inspect.go b/cmd/podman/inspect.go index ce6ccd77f..f54eb6d10 100644 --- a/cmd/podman/inspect.go +++ b/cmd/podman/inspect.go @@ -8,6 +8,7 @@ import ( specs "github.com/opencontainers/runtime-spec/specs-go" "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/pkg/inspect" "github.com/projectatomic/libpod/pkg/util" @@ -64,7 +65,7 @@ func inspectCmd(c *cli.Context) error { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "error creating libpod runtime") } diff --git a/cmd/podman/kill.go b/cmd/podman/kill.go index c24e68c54..99e111177 100644 --- a/cmd/podman/kill.go +++ b/cmd/podman/kill.go @@ -7,6 +7,7 @@ import ( "fmt" "github.com/docker/docker/pkg/signal" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/urfave/cli" ) @@ -44,7 +45,7 @@ func killCmd(c *cli.Context) error { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/libpodruntime/runtime.go b/cmd/podman/libpodruntime/runtime.go new file mode 100644 index 000000000..f9c14f6e7 --- /dev/null +++ b/cmd/podman/libpodruntime/runtime.go @@ -0,0 +1,59 @@ +package libpodruntime + +import ( + "github.com/containers/storage" + "github.com/projectatomic/libpod/libpod" + "github.com/urfave/cli" +) + +// GetRuntime generates a new libpod runtime configured by command line options +func GetRuntime(c *cli.Context) (*libpod.Runtime, error) { + options := []libpod.RuntimeOption{} + + if c.GlobalIsSet("root") || c.GlobalIsSet("runroot") || + c.GlobalIsSet("storage-opt") || c.GlobalIsSet("storage-driver") { + storageOpts := storage.DefaultStoreOptions + + if c.GlobalIsSet("root") { + storageOpts.GraphRoot = c.GlobalString("root") + } + if c.GlobalIsSet("runroot") { + storageOpts.RunRoot = c.GlobalString("runroot") + } + if c.GlobalIsSet("storage-driver") { + storageOpts.GraphDriverName = c.GlobalString("storage-driver") + } + if c.GlobalIsSet("storage-opt") { + storageOpts.GraphDriverOptions = c.GlobalStringSlice("storage-opt") + } + + options = append(options, libpod.WithStorageConfig(storageOpts)) + } + + // TODO CLI flags for image config? + // TODO CLI flag for signature policy? + + if c.GlobalIsSet("runtime") { + options = append(options, libpod.WithOCIRuntime(c.GlobalString("runtime"))) + } + + if c.GlobalIsSet("conmon") { + options = append(options, libpod.WithConmonPath(c.GlobalString("conmon"))) + } + + // TODO flag to set CGroup manager? + // TODO flag to set libpod static dir? + // TODO flag to set libpod tmp dir? + + if c.GlobalIsSet("cni-config-dir") { + options = append(options, libpod.WithCNIConfigDir(c.GlobalString("cni-config-dir"))) + } + if c.GlobalIsSet("default-mounts-file") { + options = append(options, libpod.WithDefaultMountsFile(c.GlobalString("default-mounts-file"))) + } + options = append(options, libpod.WithHooksDir(c.GlobalString("hooks-dir-path"))) + + // TODO flag to set CNI plugins dir? + + return libpod.NewRuntime(options...) +} diff --git a/cmd/podman/load.go b/cmd/podman/load.go index ec616170c..8186f1cc2 100644 --- a/cmd/podman/load.go +++ b/cmd/podman/load.go @@ -7,6 +7,7 @@ import ( "os" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/projectatomic/libpod/libpod" libpodImage "github.com/projectatomic/libpod/libpod/image" "github.com/urfave/cli" @@ -56,7 +57,7 @@ func loadCmd(c *cli.Context) error { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/logs.go b/cmd/podman/logs.go index 6e5ab03dc..26ca2330f 100644 --- a/cmd/podman/logs.go +++ b/cmd/podman/logs.go @@ -9,6 +9,7 @@ import ( "bufio" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/projectatomic/libpod/libpod" "github.com/sirupsen/logrus" "github.com/urfave/cli" @@ -67,7 +68,7 @@ func logsCmd(c *cli.Context) error { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/mount.go b/cmd/podman/mount.go index 2d274cfaf..e913afb75 100644 --- a/cmd/podman/mount.go +++ b/cmd/podman/mount.go @@ -6,6 +6,7 @@ import ( "github.com/pkg/errors" of "github.com/projectatomic/libpod/cmd/podman/formats" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/urfave/cli" ) @@ -50,7 +51,7 @@ func mountCmd(c *cli.Context) error { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/pause.go b/cmd/podman/pause.go index cd581b08f..f97a1c61b 100644 --- a/cmd/podman/pause.go +++ b/cmd/podman/pause.go @@ -5,6 +5,7 @@ import ( "os" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/urfave/cli" ) @@ -24,7 +25,7 @@ var ( ) func pauseCmd(c *cli.Context) error { - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/port.go b/cmd/podman/port.go index f105a14ed..340bf1e9c 100644 --- a/cmd/podman/port.go +++ b/cmd/podman/port.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) @@ -88,7 +89,7 @@ func portCmd(c *cli.Context) error { } } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go index ca4c4ca82..0893e869a 100644 --- a/cmd/podman/ps.go +++ b/cmd/podman/ps.go @@ -16,6 +16,7 @@ import ( specs "github.com/opencontainers/runtime-spec/specs-go" "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/pkg/util" "github.com/sirupsen/logrus" @@ -154,7 +155,7 @@ func psCmd(c *cli.Context) error { return errors.Wrapf(err, "error with flags passed") } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "error creating libpod runtime") } diff --git a/cmd/podman/pull.go b/cmd/podman/pull.go index 14e4e9252..0712283c3 100644 --- a/cmd/podman/pull.go +++ b/cmd/podman/pull.go @@ -8,6 +8,7 @@ import ( "github.com/containers/image/types" "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" @@ -59,7 +60,7 @@ var ( // to copy an image from a registry to a local machine func pullCmd(c *cli.Context) error { forceSecure := false - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/push.go b/cmd/podman/push.go index 369d4d4f2..dc1894ebb 100644 --- a/cmd/podman/push.go +++ b/cmd/podman/push.go @@ -10,6 +10,7 @@ import ( "github.com/containers/image/types" 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" "github.com/projectatomic/libpod/libpod/image" "github.com/projectatomic/libpod/pkg/util" @@ -117,7 +118,7 @@ func pushCmd(c *cli.Context) error { registryCreds = creds } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not create runtime") } diff --git a/cmd/podman/restart.go b/cmd/podman/restart.go index 7eb168743..e01a76fd0 100644 --- a/cmd/podman/restart.go +++ b/cmd/podman/restart.go @@ -5,6 +5,7 @@ import ( "os" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) @@ -41,7 +42,7 @@ func restartCmd(c *cli.Context) error { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "error creating libpod runtime") } diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go index 182089e8e..d6af6db07 100644 --- a/cmd/podman/rm.go +++ b/cmd/podman/rm.go @@ -5,6 +5,7 @@ import ( "os" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) @@ -40,7 +41,7 @@ func rmCmd(c *cli.Context) error { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/rmi.go b/cmd/podman/rmi.go index c1be6dabb..dcf46a8e5 100644 --- a/cmd/podman/rmi.go +++ b/cmd/podman/rmi.go @@ -6,6 +6,7 @@ import ( "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" ) @@ -38,7 +39,7 @@ func rmiCmd(c *cli.Context) error { return err } removeAll := c.Bool("all") - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/run.go b/cmd/podman/run.go index abb319a63..5f0034e90 100644 --- a/cmd/podman/run.go +++ b/cmd/podman/run.go @@ -10,6 +10,7 @@ import ( "strings" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/projectatomic/libpod/libpod" "github.com/projectatomic/libpod/libpod/image" "github.com/sirupsen/logrus" @@ -49,7 +50,7 @@ func runCmd(c *cli.Context) error { } } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "error creating libpod runtime") } diff --git a/cmd/podman/save.go b/cmd/podman/save.go index edf725e6d..e41e95f69 100644 --- a/cmd/podman/save.go +++ b/cmd/podman/save.go @@ -8,6 +8,7 @@ import ( "github.com/containers/image/manifest" 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" libpodImage "github.com/projectatomic/libpod/libpod/image" "github.com/sirupsen/logrus" @@ -64,7 +65,7 @@ func saveCmd(c *cli.Context) error { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not create runtime") } diff --git a/cmd/podman/search.go b/cmd/podman/search.go index 106513e34..803661753 100644 --- a/cmd/podman/search.go +++ b/cmd/podman/search.go @@ -9,6 +9,7 @@ import ( "github.com/containers/image/docker" "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" @@ -92,7 +93,7 @@ func searchCmd(c *cli.Context) error { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/start.go b/cmd/podman/start.go index fb16e08cd..e10d338d8 100644 --- a/cmd/podman/start.go +++ b/cmd/podman/start.go @@ -5,6 +5,7 @@ import ( "os" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/projectatomic/libpod/libpod" "github.com/sirupsen/logrus" "github.com/urfave/cli" @@ -67,7 +68,7 @@ func startCmd(c *cli.Context) error { return errors.Wrapf(libpod.ErrInvalidArg, "you cannot use sig-proxy without --attach") } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "error creating libpod runtime") } diff --git a/cmd/podman/stats.go b/cmd/podman/stats.go index 6a8681028..06e948d8c 100644 --- a/cmd/podman/stats.go +++ b/cmd/podman/stats.go @@ -10,6 +10,7 @@ import ( "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" ) @@ -78,7 +79,7 @@ func statsCmd(c *cli.Context) error { return errors.Errorf("--all, --latest and containers cannot be used together") } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/stop.go b/cmd/podman/stop.go index 5bfa05708..820d1acb2 100644 --- a/cmd/podman/stop.go +++ b/cmd/podman/stop.go @@ -5,6 +5,7 @@ import ( "os" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) @@ -54,7 +55,7 @@ func stopCmd(c *cli.Context) error { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/tag.go b/cmd/podman/tag.go index d2a157e7f..d1d1693a3 100644 --- a/cmd/podman/tag.go +++ b/cmd/podman/tag.go @@ -2,6 +2,7 @@ package main import ( "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/urfave/cli" ) @@ -21,7 +22,7 @@ func tagCmd(c *cli.Context) error { if len(args) < 2 { return errors.Errorf("image name and at least one new name must be specified") } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not create runtime") } diff --git a/cmd/podman/top.go b/cmd/podman/top.go index 5ff3b6643..7ea8a1169 100644 --- a/cmd/podman/top.go +++ b/cmd/podman/top.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) @@ -42,7 +43,7 @@ func topCmd(c *cli.Context) error { return err } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "error creating libpod runtime") } diff --git a/cmd/podman/umount.go b/cmd/podman/umount.go index 4b6aba99e..803cf034a 100644 --- a/cmd/podman/umount.go +++ b/cmd/podman/umount.go @@ -2,6 +2,7 @@ package main import ( "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/urfave/cli" ) @@ -17,7 +18,7 @@ var ( ) func umountCmd(c *cli.Context) error { - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/unpause.go b/cmd/podman/unpause.go index a7ef65f85..6571dff4e 100644 --- a/cmd/podman/unpause.go +++ b/cmd/podman/unpause.go @@ -5,6 +5,7 @@ import ( "os" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/urfave/cli" ) @@ -24,7 +25,7 @@ var ( ) func unpauseCmd(c *cli.Context) error { - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") } diff --git a/cmd/podman/utils.go b/cmd/podman/utils.go index a74c338cc..254b3d547 100644 --- a/cmd/podman/utils.go +++ b/cmd/podman/utils.go @@ -5,69 +5,15 @@ import ( "os" gosignal "os/signal" - "github.com/containers/storage" "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" "k8s.io/client-go/tools/remotecommand" ) -// Generate a new libpod runtime configured by command line options -func getRuntime(c *cli.Context) (*libpod.Runtime, error) { - options := []libpod.RuntimeOption{} - - if c.GlobalIsSet("root") || c.GlobalIsSet("runroot") || - c.GlobalIsSet("storage-opt") || c.GlobalIsSet("storage-driver") { - storageOpts := storage.DefaultStoreOptions - - if c.GlobalIsSet("root") { - storageOpts.GraphRoot = c.GlobalString("root") - } - if c.GlobalIsSet("runroot") { - storageOpts.RunRoot = c.GlobalString("runroot") - } - if c.GlobalIsSet("storage-driver") { - storageOpts.GraphDriverName = c.GlobalString("storage-driver") - } - if c.GlobalIsSet("storage-opt") { - storageOpts.GraphDriverOptions = c.GlobalStringSlice("storage-opt") - } - - options = append(options, libpod.WithStorageConfig(storageOpts)) - } - - // TODO CLI flags for image config? - // TODO CLI flag for signature policy? - - if c.GlobalIsSet("runtime") { - options = append(options, libpod.WithOCIRuntime(c.GlobalString("runtime"))) - } - - if c.GlobalIsSet("conmon") { - options = append(options, libpod.WithConmonPath(c.GlobalString("conmon"))) - } - - // TODO flag to set CGroup manager? - // TODO flag to set libpod static dir? - // TODO flag to set libpod tmp dir? - - if c.GlobalIsSet("cni-config-dir") { - options = append(options, libpod.WithCNIConfigDir(c.GlobalString("cni-config-dir"))) - } - if c.GlobalIsSet("default-mounts-file") { - options = append(options, libpod.WithDefaultMountsFile(c.GlobalString("default-mounts-file"))) - } - options = append(options, libpod.WithHooksDir(c.GlobalString("hooks-dir-path"))) - - // TODO flag to set CNI plugins dir? - - return libpod.NewRuntime(options...) -} - // Attach to a container func attachCtr(ctr *libpod.Container, stdout, stderr, stdin *os.File, detachKeys string, sigProxy bool) error { resize := make(chan remotecommand.TerminalSize) diff --git a/cmd/podman/varlink.go b/cmd/podman/varlink.go index 75ddc6c4d..a25f776e1 100644 --- a/cmd/podman/varlink.go +++ b/cmd/podman/varlink.go @@ -2,7 +2,7 @@ package main import ( "github.com/pkg/errors" - "github.com/projectatomic/libpod/cmd/podman/ioprojectatomicpodman" + ioprojectatomicpodman "github.com/projectatomic/libpod/cmd/podman/varlink" "github.com/projectatomic/libpod/pkg/varlinkapi" "github.com/projectatomic/libpod/version" "github.com/urfave/cli" @@ -32,7 +32,7 @@ func varlinkCmd(c *cli.Context) error { return errors.Errorf("you must provide a varlink URI") } - var varlinkInterfaces = []*ioprojectatomicpodman.VarlinkInterface{varlinkapi.VarlinkLibpod} + var varlinkInterfaces = []*ioprojectatomicpodman.VarlinkInterface{varlinkapi.New(c)} // Register varlink service. The metadata can be retrieved with: // $ varlink info [varlink address URI] service, err := varlink.NewService( diff --git a/cmd/podman/ioprojectatomicpodman/generate.go b/cmd/podman/varlink/generate.go index b07f8b06b..b07f8b06b 100644 --- a/cmd/podman/ioprojectatomicpodman/generate.go +++ b/cmd/podman/varlink/generate.go diff --git a/cmd/podman/ioprojectatomicpodman/io.projectatomic.podman.varlink b/cmd/podman/varlink/io.projectatomic.podman.varlink index 00a99017c..ff53eb2ec 100644 --- a/cmd/podman/ioprojectatomicpodman/io.projectatomic.podman.varlink +++ b/cmd/podman/varlink/io.projectatomic.podman.varlink @@ -1,6 +1,8 @@ # Podman Service Interface interface io.projectatomic.podman + +# Version is the structure returned by GetVersion type Version ( version: string, go_version: string, @@ -17,6 +19,40 @@ type StringResponse ( message: string ) +# ImageInList describes the structure that is returned in +# ListImages. +type ImageInList ( + id: string, + parentId: string, + repoTags: []string, + repoDigests: []string, + created: string, + size: int, + virtualSize: int, + containers: int, + labels: [string]string +) + +# ImageHistory describes the returned structure from ImageHistory. +type ImageHistory ( + id: string, + created: string, + createdBy: string, + tags: []string, + size: int, + comment: string +) + +# ImageSearch is the returned structure for SearchImage. It is returned +# in arrary form. +type ImageSearch ( + description: string, + is_official: bool, + is_automated: bool, + name: string, + star_count: int +) + # System method Ping() -> (ping: StringResponse) method GetVersion() -> (version: Version) @@ -45,21 +81,24 @@ method RemoveContainer() -> (notimplemented: NotImplemented) method DeleteStoppedContainers() -> (notimplemented: NotImplemented) # Images -method ListImages() -> (notimplemented: NotImplemented) +method ListImages() -> (images: []ImageInList) method BuildImage() -> (notimplemented: NotImplemented) method CreateImage() -> (notimplemented: NotImplemented) -method InspectImage() -> (notimplemented: NotImplemented) -method HistoryImage() -> (notimplemented: NotImplemented) -method PushImage() -> (notimplemented: NotImplemented) -method TagImage() -> (notimplemented: NotImplemented) -method RemoveImage() -> (notimplemented: NotImplemented) -method SearchImage() -> (notimplemented: NotImplemented) -method DeleteUnusedImages() -> (notimplemented: NotImplemented) +method InspectImage(name: string) -> (image: string) +method HistoryImage(name: string) -> (history: []ImageHistory) +method PushImage(name: string, tag: string, tlsverify: bool) -> () +method TagImage(name: string, tagged: string) -> () +method RemoveImage(name: string, force: bool) -> () +method SearchImage(name: string, limit: int) -> (images: []ImageSearch) +method DeleteUnusedImages() -> (images: []string) method CreateFromContainer() -> (notimplemented: NotImplemented) -method ImportImage() -> (notimplemented: NotImplemented) -method ExportImage() -> (notimplemented: NotImplemented) -method PullImage() -> (notimplemented: NotImplemented) +method ImportImage(source: string, reference: string, message: string, changes: []string) -> (id: string) +method ExportImage(name: string, destination: string, compress: bool) -> () +method PullImage(name: string) -> (id: string) # Something failed error ActionFailed (reason: string) +error ImageNotFound (imagename: string) +error ErrorOccurred (reason: string) +error RuntimeError (reason: string)
\ No newline at end of file diff --git a/cmd/podman/ioprojectatomicpodman/ioprojectatomicpodman.go b/cmd/podman/varlink/ioprojectatomicpodman.go index 687e5e77d..41e2b7f29 100644 --- a/cmd/podman/ioprojectatomicpodman/ioprojectatomicpodman.go +++ b/cmd/podman/varlink/ioprojectatomicpodman.go @@ -20,12 +20,41 @@ type StringResponse struct { Message string `json:"message"` } +type ImageInList struct { + Id string `json:"id"` + ParentId string `json:"parentId"` + RepoTags []string `json:"repoTags"` + RepoDigests []string `json:"repoDigests"` + Created string `json:"created"` + Size int64 `json:"size"` + VirtualSize int64 `json:"virtualSize"` + Containers int64 `json:"containers"` + Labels map[string]string `json:"labels"` +} + +type ImageHistory struct { + Id string `json:"id"` + Created string `json:"created"` + CreatedBy string `json:"createdBy"` + Tags []string `json:"tags"` + Size int64 `json:"size"` + Comment string `json:"comment"` +} + +type ImageSearch struct { + Description string `json:"description"` + Is_official bool `json:"is_official"` + Is_automated bool `json:"is_automated"` + Name string `json:"name"` + Star_count int64 `json:"star_count"` +} + // Client method calls and reply readers -func UpdateContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.UpdateContainer", nil, more__, oneway__) +func InspectContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.InspectContainer", nil, more__, oneway__) } -func ReadUpdateContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadInspectContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -39,11 +68,11 @@ func ReadUpdateContainer_(c__ *varlink.Connection, notimplemented_ *NotImplement return continues_, nil } -func RemoveContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.RemoveContainer", nil, more__, oneway__) +func ListContainerChanges(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.ListContainerChanges", nil, more__, oneway__) } -func ReadRemoveContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadListContainerChanges_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -57,11 +86,11 @@ func ReadRemoveContainer_(c__ *varlink.Connection, notimplemented_ *NotImplement return continues_, nil } -func HistoryImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.HistoryImage", nil, more__, oneway__) +func GetContainerStats(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.GetContainerStats", nil, more__, oneway__) } -func ReadHistoryImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadGetContainerStats_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -75,65 +104,79 @@ func ReadHistoryImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) return continues_, nil } -func ListContainerChanges(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.ListContainerChanges", nil, more__, oneway__) +func InspectImage(c__ *varlink.Connection, more__ bool, oneway__ bool, name_ string) error { + var in struct { + Name string `json:"name"` + } + in.Name = name_ + return c__.Send("io.projectatomic.podman.InspectImage", in, more__, oneway__) } -func ReadListContainerChanges_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadInspectImage_(c__ *varlink.Connection, image_ *string) (bool, error) { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Image string `json:"image"` } continues_, err := c__.Receive(&out) if err != nil { return false, err } - if notimplemented_ != nil { - *notimplemented_ = out.Notimplemented + if image_ != nil { + *image_ = out.Image } return continues_, nil } -func ResizeContainerTty(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.ResizeContainerTty", nil, more__, oneway__) +func DeleteUnusedImages(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.DeleteUnusedImages", nil, more__, oneway__) } -func ReadResizeContainerTty_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadDeleteUnusedImages_(c__ *varlink.Connection, images_ *[]string) (bool, error) { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Images []string `json:"images"` } continues_, err := c__.Receive(&out) if err != nil { return false, err } - if notimplemented_ != nil { - *notimplemented_ = out.Notimplemented + if images_ != nil { + *images_ = []string(out.Images) } return continues_, nil } -func RestartContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.RestartContainer", nil, more__, oneway__) +func ImportImage(c__ *varlink.Connection, more__ bool, oneway__ bool, source_ string, reference_ string, message_ string, changes_ []string) error { + var in struct { + Source string `json:"source"` + Reference string `json:"reference"` + Message string `json:"message"` + Changes []string `json:"changes"` + } + in.Source = source_ + in.Reference = reference_ + in.Message = message_ + in.Changes = []string(changes_) + return c__.Send("io.projectatomic.podman.ImportImage", in, more__, oneway__) } -func ReadRestartContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadImportImage_(c__ *varlink.Connection, id_ *string) (bool, error) { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Id string `json:"id"` } continues_, err := c__.Receive(&out) if err != nil { return false, err } - if notimplemented_ != nil { - *notimplemented_ = out.Notimplemented + if id_ != nil { + *id_ = out.Id } return continues_, nil } -func BuildImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.BuildImage", nil, more__, oneway__) +func ListContainers(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.ListContainers", nil, more__, oneway__) } -func ReadBuildImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadListContainers_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -147,11 +190,11 @@ func ReadBuildImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) ( return continues_, nil } -func ListContainers(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.ListContainers", nil, more__, oneway__) +func AttachToContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.AttachToContainer", nil, more__, oneway__) } -func ReadListContainers_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadAttachToContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -165,11 +208,11 @@ func ReadListContainers_(c__ *varlink.Connection, notimplemented_ *NotImplemente return continues_, nil } -func StartContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.StartContainer", nil, more__, oneway__) +func RemoveContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.RemoveContainer", nil, more__, oneway__) } -func ReadStartContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadRemoveContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -183,11 +226,11 @@ func ReadStartContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemente return continues_, nil } -func ListImages(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.ListImages", nil, more__, oneway__) +func KillContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.KillContainer", nil, more__, oneway__) } -func ReadListImages_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadKillContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -201,29 +244,29 @@ func ReadListImages_(c__ *varlink.Connection, notimplemented_ *NotImplemented) ( return continues_, nil } -func GetVersion(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.GetVersion", nil, more__, oneway__) +func ResizeContainerTty(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.ResizeContainerTty", nil, more__, oneway__) } -func ReadGetVersion_(c__ *varlink.Connection, version_ *Version) (bool, error) { +func ReadResizeContainerTty_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { - Version Version `json:"version"` + Notimplemented NotImplemented `json:"notimplemented"` } continues_, err := c__.Receive(&out) if err != nil { return false, err } - if version_ != nil { - *version_ = out.Version + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented } return continues_, nil } -func UnpauseContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.UnpauseContainer", nil, more__, oneway__) +func StartContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.StartContainer", nil, more__, oneway__) } -func ReadUnpauseContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadStartContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -237,11 +280,11 @@ func ReadUnpauseContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemen return continues_, nil } -func DeleteUnusedImages(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.DeleteUnusedImages", nil, more__, oneway__) +func StopContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.StopContainer", nil, more__, oneway__) } -func ReadDeleteUnusedImages_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadStopContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -255,11 +298,11 @@ func ReadDeleteUnusedImages_(c__ *varlink.Connection, notimplemented_ *NotImplem return continues_, nil } -func KillContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.KillContainer", nil, more__, oneway__) +func UnpauseContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.UnpauseContainer", nil, more__, oneway__) } -func ReadKillContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadUnpauseContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -273,47 +316,47 @@ func ReadKillContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented return continues_, nil } -func RemoveImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.RemoveImage", nil, more__, oneway__) +func GetVersion(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.GetVersion", nil, more__, oneway__) } -func ReadRemoveImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadGetVersion_(c__ *varlink.Connection, version_ *Version) (bool, error) { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Version Version `json:"version"` } continues_, err := c__.Receive(&out) if err != nil { return false, err } - if notimplemented_ != nil { - *notimplemented_ = out.Notimplemented + if version_ != nil { + *version_ = out.Version } return continues_, nil } -func CreateContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.CreateContainer", nil, more__, oneway__) +func Ping(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.Ping", nil, more__, oneway__) } -func ReadCreateContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadPing_(c__ *varlink.Connection, ping_ *StringResponse) (bool, error) { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Ping StringResponse `json:"ping"` } continues_, err := c__.Receive(&out) if err != nil { return false, err } - if notimplemented_ != nil { - *notimplemented_ = out.Notimplemented + if ping_ != nil { + *ping_ = out.Ping } return continues_, nil } -func InspectContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.InspectContainer", nil, more__, oneway__) +func WaitContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.WaitContainer", nil, more__, oneway__) } -func ReadInspectContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadWaitContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -327,11 +370,11 @@ func ReadInspectContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemen return continues_, nil } -func ExportContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.ExportContainer", nil, more__, oneway__) +func BuildImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.BuildImage", nil, more__, oneway__) } -func ReadExportContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadBuildImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -345,101 +388,115 @@ func ReadExportContainer_(c__ *varlink.Connection, notimplemented_ *NotImplement return continues_, nil } -func TagImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.TagImage", nil, more__, oneway__) +func HistoryImage(c__ *varlink.Connection, more__ bool, oneway__ bool, name_ string) error { + var in struct { + Name string `json:"name"` + } + in.Name = name_ + return c__.Send("io.projectatomic.podman.HistoryImage", in, more__, oneway__) } -func ReadTagImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadHistoryImage_(c__ *varlink.Connection, history_ *[]ImageHistory) (bool, error) { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + History []ImageHistory `json:"history"` } continues_, err := c__.Receive(&out) if err != nil { return false, err } - if notimplemented_ != nil { - *notimplemented_ = out.Notimplemented + if history_ != nil { + *history_ = []ImageHistory(out.History) } return continues_, nil } -func ImportImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.ImportImage", nil, more__, oneway__) +func PushImage(c__ *varlink.Connection, more__ bool, oneway__ bool, name_ string, tag_ string, tlsverify_ bool) error { + var in struct { + Name string `json:"name"` + Tag string `json:"tag"` + Tlsverify bool `json:"tlsverify"` + } + in.Name = name_ + in.Tag = tag_ + in.Tlsverify = tlsverify_ + return c__.Send("io.projectatomic.podman.PushImage", in, more__, oneway__) } -func ReadImportImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { - var out struct { - Notimplemented NotImplemented `json:"notimplemented"` - } - continues_, err := c__.Receive(&out) +func ReadPushImage_(c__ *varlink.Connection) (bool, error) { + continues_, err := c__.Receive(nil) if err != nil { return false, err } - if notimplemented_ != nil { - *notimplemented_ = out.Notimplemented - } return continues_, nil } -func Ping(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.Ping", nil, more__, oneway__) +func TagImage(c__ *varlink.Connection, more__ bool, oneway__ bool, name_ string, tagged_ string) error { + var in struct { + Name string `json:"name"` + Tagged string `json:"tagged"` + } + in.Name = name_ + in.Tagged = tagged_ + return c__.Send("io.projectatomic.podman.TagImage", in, more__, oneway__) } -func ReadPing_(c__ *varlink.Connection, ping_ *StringResponse) (bool, error) { - var out struct { - Ping StringResponse `json:"ping"` - } - continues_, err := c__.Receive(&out) +func ReadTagImage_(c__ *varlink.Connection) (bool, error) { + continues_, err := c__.Receive(nil) if err != nil { return false, err } - if ping_ != nil { - *ping_ = out.Ping - } return continues_, nil } -func GetContainerLogs(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.GetContainerLogs", nil, more__, oneway__) +func SearchImage(c__ *varlink.Connection, more__ bool, oneway__ bool, name_ string, limit_ int64) error { + var in struct { + Name string `json:"name"` + Limit int64 `json:"limit"` + } + in.Name = name_ + in.Limit = limit_ + return c__.Send("io.projectatomic.podman.SearchImage", in, more__, oneway__) } -func ReadGetContainerLogs_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadSearchImage_(c__ *varlink.Connection, images_ *[]ImageSearch) (bool, error) { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Images []ImageSearch `json:"images"` } continues_, err := c__.Receive(&out) if err != nil { return false, err } - if notimplemented_ != nil { - *notimplemented_ = out.Notimplemented + if images_ != nil { + *images_ = []ImageSearch(out.Images) } return continues_, nil } -func AttachToContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.AttachToContainer", nil, more__, oneway__) +func ExportImage(c__ *varlink.Connection, more__ bool, oneway__ bool, name_ string, destination_ string, compress_ bool) error { + var in struct { + Name string `json:"name"` + Destination string `json:"destination"` + Compress bool `json:"compress"` + } + in.Name = name_ + in.Destination = destination_ + in.Compress = compress_ + return c__.Send("io.projectatomic.podman.ExportImage", in, more__, oneway__) } -func ReadAttachToContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { - var out struct { - Notimplemented NotImplemented `json:"notimplemented"` - } - continues_, err := c__.Receive(&out) +func ReadExportImage_(c__ *varlink.Connection) (bool, error) { + continues_, err := c__.Receive(nil) if err != nil { return false, err } - if notimplemented_ != nil { - *notimplemented_ = out.Notimplemented - } return continues_, nil } -func DeleteStoppedContainers(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.DeleteStoppedContainers", nil, more__, oneway__) +func RenameContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.RenameContainer", nil, more__, oneway__) } -func ReadDeleteStoppedContainers_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadRenameContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -453,29 +510,29 @@ func ReadDeleteStoppedContainers_(c__ *varlink.Connection, notimplemented_ *NotI return continues_, nil } -func CreateFromContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.CreateFromContainer", nil, more__, oneway__) +func RemoveImage(c__ *varlink.Connection, more__ bool, oneway__ bool, name_ string, force_ bool) error { + var in struct { + Name string `json:"name"` + Force bool `json:"force"` + } + in.Name = name_ + in.Force = force_ + return c__.Send("io.projectatomic.podman.RemoveImage", in, more__, oneway__) } -func ReadCreateFromContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { - var out struct { - Notimplemented NotImplemented `json:"notimplemented"` - } - continues_, err := c__.Receive(&out) +func ReadRemoveImage_(c__ *varlink.Connection) (bool, error) { + continues_, err := c__.Receive(nil) if err != nil { return false, err } - if notimplemented_ != nil { - *notimplemented_ = out.Notimplemented - } return continues_, nil } -func ExportImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.ExportImage", nil, more__, oneway__) +func ExportContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.ExportContainer", nil, more__, oneway__) } -func ReadExportImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadExportContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -489,11 +546,11 @@ func ReadExportImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) return continues_, nil } -func PullImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.PullImage", nil, more__, oneway__) +func RestartContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.RestartContainer", nil, more__, oneway__) } -func ReadPullImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadRestartContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -507,11 +564,11 @@ func ReadPullImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (b return continues_, nil } -func GetContainerStats(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.GetContainerStats", nil, more__, oneway__) +func UpdateContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.UpdateContainer", nil, more__, oneway__) } -func ReadGetContainerStats_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadUpdateContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -525,11 +582,11 @@ func ReadGetContainerStats_(c__ *varlink.Connection, notimplemented_ *NotImpleme return continues_, nil } -func StopContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.StopContainer", nil, more__, oneway__) +func PauseContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.PauseContainer", nil, more__, oneway__) } -func ReadStopContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadPauseContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -543,11 +600,11 @@ func ReadStopContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented return continues_, nil } -func WaitContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.WaitContainer", nil, more__, oneway__) +func DeleteStoppedContainers(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.DeleteStoppedContainers", nil, more__, oneway__) } -func ReadWaitContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadDeleteStoppedContainers_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -561,11 +618,11 @@ func ReadWaitContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented return continues_, nil } -func RenameContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.RenameContainer", nil, more__, oneway__) +func CreateImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.CreateImage", nil, more__, oneway__) } -func ReadRenameContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadCreateImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -579,11 +636,11 @@ func ReadRenameContainer_(c__ *varlink.Connection, notimplemented_ *NotImplement return continues_, nil } -func PauseContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.PauseContainer", nil, more__, oneway__) +func CreateFromContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.CreateFromContainer", nil, more__, oneway__) } -func ReadPauseContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadCreateFromContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -597,29 +654,33 @@ func ReadPauseContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemente return continues_, nil } -func PushImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.PushImage", nil, more__, oneway__) +func PullImage(c__ *varlink.Connection, more__ bool, oneway__ bool, name_ string) error { + var in struct { + Name string `json:"name"` + } + in.Name = name_ + return c__.Send("io.projectatomic.podman.PullImage", in, more__, oneway__) } -func ReadPushImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadPullImage_(c__ *varlink.Connection, id_ *string) (bool, error) { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Id string `json:"id"` } continues_, err := c__.Receive(&out) if err != nil { return false, err } - if notimplemented_ != nil { - *notimplemented_ = out.Notimplemented + if id_ != nil { + *id_ = out.Id } return continues_, nil } -func SearchImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.SearchImage", nil, more__, oneway__) +func GetContainerLogs(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.GetContainerLogs", nil, more__, oneway__) } -func ReadSearchImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadGetContainerLogs_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -651,29 +712,29 @@ func ReadListContainerProcesses_(c__ *varlink.Connection, notimplemented_ *NotIm return continues_, nil } -func CreateImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.CreateImage", nil, more__, oneway__) +func ListImages(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.ListImages", nil, more__, oneway__) } -func ReadCreateImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadListImages_(c__ *varlink.Connection, images_ *[]ImageInList) (bool, error) { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Images []ImageInList `json:"images"` } continues_, err := c__.Receive(&out) if err != nil { return false, err } - if notimplemented_ != nil { - *notimplemented_ = out.Notimplemented + if images_ != nil { + *images_ = []ImageInList(out.Images) } return continues_, nil } -func InspectImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { - return c__.Send("io.projectatomic.podman.InspectImage", nil, more__, oneway__) +func CreateContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.CreateContainer", nil, more__, oneway__) } -func ReadInspectImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { +func ReadCreateContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -689,43 +750,43 @@ func ReadInspectImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) // Service interface with all methods type ioprojectatomicpodmanInterface interface { - GetVersion(c__ VarlinkCall) error - UnpauseContainer(c__ VarlinkCall) error - DeleteUnusedImages(c__ VarlinkCall) error + PauseContainer(c__ VarlinkCall) error + DeleteStoppedContainers(c__ VarlinkCall) error + CreateImage(c__ VarlinkCall) error + CreateFromContainer(c__ VarlinkCall) error + PullImage(c__ VarlinkCall, name_ string) error + GetContainerLogs(c__ VarlinkCall) error + RestartContainer(c__ VarlinkCall) error + UpdateContainer(c__ VarlinkCall) error CreateContainer(c__ VarlinkCall) error + ListContainerProcesses(c__ VarlinkCall) error + ListImages(c__ VarlinkCall) error + GetContainerStats(c__ VarlinkCall) error + InspectImage(c__ VarlinkCall, name_ string) error + DeleteUnusedImages(c__ VarlinkCall) error + ImportImage(c__ VarlinkCall, source_ string, reference_ string, message_ string, changes_ []string) error + ListContainers(c__ VarlinkCall) error InspectContainer(c__ VarlinkCall) error - ExportContainer(c__ VarlinkCall) error + ListContainerChanges(c__ VarlinkCall) error KillContainer(c__ VarlinkCall) error - RemoveImage(c__ VarlinkCall) error - Ping(c__ VarlinkCall) error - GetContainerLogs(c__ VarlinkCall) error AttachToContainer(c__ VarlinkCall) error - TagImage(c__ VarlinkCall) error - ImportImage(c__ VarlinkCall) error - PullImage(c__ VarlinkCall) error - GetContainerStats(c__ VarlinkCall) error + RemoveContainer(c__ VarlinkCall) error StopContainer(c__ VarlinkCall) error - WaitContainer(c__ VarlinkCall) error - DeleteStoppedContainers(c__ VarlinkCall) error - CreateFromContainer(c__ VarlinkCall) error - ExportImage(c__ VarlinkCall) error - RenameContainer(c__ VarlinkCall) error - PauseContainer(c__ VarlinkCall) error - ListContainerProcesses(c__ VarlinkCall) error - CreateImage(c__ VarlinkCall) error - InspectImage(c__ VarlinkCall) error - PushImage(c__ VarlinkCall) error - SearchImage(c__ VarlinkCall) error - ListContainerChanges(c__ VarlinkCall) error + UnpauseContainer(c__ VarlinkCall) error + GetVersion(c__ VarlinkCall) error ResizeContainerTty(c__ VarlinkCall) error - RestartContainer(c__ VarlinkCall) error - UpdateContainer(c__ VarlinkCall) error - RemoveContainer(c__ VarlinkCall) error - HistoryImage(c__ VarlinkCall) error - ListContainers(c__ VarlinkCall) error StartContainer(c__ VarlinkCall) error - ListImages(c__ VarlinkCall) error + Ping(c__ VarlinkCall) error + HistoryImage(c__ VarlinkCall, name_ string) error + PushImage(c__ VarlinkCall, name_ string, tag_ string, tlsverify_ bool) error + TagImage(c__ VarlinkCall, name_ string, tagged_ string) error + SearchImage(c__ VarlinkCall, name_ string, limit_ int64) error + ExportImage(c__ VarlinkCall, name_ string, destination_ string, compress_ bool) error + RenameContainer(c__ VarlinkCall) error + WaitContainer(c__ VarlinkCall) error BuildImage(c__ VarlinkCall) error + ExportContainer(c__ VarlinkCall) error + RemoveImage(c__ VarlinkCall, name_ string, force_ bool) error } // Service object with all methods @@ -740,40 +801,40 @@ func (c__ *VarlinkCall) ReplyActionFailed(reason_ string) error { return c__.ReplyError("io.projectatomic.podman.ActionFailed", &out) } -// Reply methods for all varlink methods -func (c__ *VarlinkCall) ReplyRenameContainer(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyImageNotFound(imagename_ string) error { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Imagename string `json:"imagename"` } - out.Notimplemented = notimplemented_ - return c__.Reply(&out) + out.Imagename = imagename_ + return c__.ReplyError("io.projectatomic.podman.ImageNotFound", &out) } -func (c__ *VarlinkCall) ReplyPauseContainer(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyErrorOccurred(reason_ string) error { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Reason string `json:"reason"` } - out.Notimplemented = notimplemented_ - return c__.Reply(&out) + out.Reason = reason_ + return c__.ReplyError("io.projectatomic.podman.ErrorOccurred", &out) } -func (c__ *VarlinkCall) ReplyInspectImage(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyRuntimeError(reason_ string) error { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Reason string `json:"reason"` } - out.Notimplemented = notimplemented_ - return c__.Reply(&out) + out.Reason = reason_ + return c__.ReplyError("io.projectatomic.podman.RuntimeError", &out) } -func (c__ *VarlinkCall) ReplyPushImage(notimplemented_ NotImplemented) error { +// Reply methods for all varlink methods +func (c__ *VarlinkCall) ReplyGetVersion(version_ Version) error { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Version Version `json:"version"` } - out.Notimplemented = notimplemented_ + out.Version = version_ return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplySearchImage(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyResizeContainerTty(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -781,7 +842,7 @@ func (c__ *VarlinkCall) ReplySearchImage(notimplemented_ NotImplemented) error { return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyListContainerProcesses(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyStartContainer(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -789,7 +850,7 @@ func (c__ *VarlinkCall) ReplyListContainerProcesses(notimplemented_ NotImplement return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyCreateImage(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyStopContainer(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -797,7 +858,7 @@ func (c__ *VarlinkCall) ReplyCreateImage(notimplemented_ NotImplemented) error { return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyRestartContainer(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyUnpauseContainer(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -805,31 +866,27 @@ func (c__ *VarlinkCall) ReplyRestartContainer(notimplemented_ NotImplemented) er return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyUpdateContainer(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyPing(ping_ StringResponse) error { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Ping StringResponse `json:"ping"` } - out.Notimplemented = notimplemented_ + out.Ping = ping_ return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyRemoveContainer(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplySearchImage(images_ []ImageSearch) error { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Images []ImageSearch `json:"images"` } - out.Notimplemented = notimplemented_ + out.Images = []ImageSearch(images_) return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyHistoryImage(notimplemented_ NotImplemented) error { - var out struct { - Notimplemented NotImplemented `json:"notimplemented"` - } - out.Notimplemented = notimplemented_ - return c__.Reply(&out) +func (c__ *VarlinkCall) ReplyExportImage() error { + return c__.Reply(nil) } -func (c__ *VarlinkCall) ReplyListContainerChanges(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyRenameContainer(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -837,7 +894,7 @@ func (c__ *VarlinkCall) ReplyListContainerChanges(notimplemented_ NotImplemented return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyResizeContainerTty(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyWaitContainer(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -845,7 +902,7 @@ func (c__ *VarlinkCall) ReplyResizeContainerTty(notimplemented_ NotImplemented) return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyListImages(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyBuildImage(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -853,23 +910,23 @@ func (c__ *VarlinkCall) ReplyListImages(notimplemented_ NotImplemented) error { return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyBuildImage(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyHistoryImage(history_ []ImageHistory) error { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + History []ImageHistory `json:"history"` } - out.Notimplemented = notimplemented_ + out.History = []ImageHistory(history_) return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyListContainers(notimplemented_ NotImplemented) error { - var out struct { - Notimplemented NotImplemented `json:"notimplemented"` - } - out.Notimplemented = notimplemented_ - return c__.Reply(&out) +func (c__ *VarlinkCall) ReplyPushImage() error { + return c__.Reply(nil) } -func (c__ *VarlinkCall) ReplyStartContainer(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyTagImage() error { + return c__.Reply(nil) +} + +func (c__ *VarlinkCall) ReplyExportContainer(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -877,7 +934,11 @@ func (c__ *VarlinkCall) ReplyStartContainer(notimplemented_ NotImplemented) erro return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyDeleteUnusedImages(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyRemoveImage() error { + return c__.Reply(nil) +} + +func (c__ *VarlinkCall) ReplyCreateFromContainer(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -885,15 +946,15 @@ func (c__ *VarlinkCall) ReplyDeleteUnusedImages(notimplemented_ NotImplemented) return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyGetVersion(version_ Version) error { +func (c__ *VarlinkCall) ReplyPullImage(id_ string) error { var out struct { - Version Version `json:"version"` + Id string `json:"id"` } - out.Version = version_ + out.Id = id_ return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyUnpauseContainer(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyGetContainerLogs(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -901,7 +962,7 @@ func (c__ *VarlinkCall) ReplyUnpauseContainer(notimplemented_ NotImplemented) er return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyExportContainer(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyRestartContainer(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -909,7 +970,7 @@ func (c__ *VarlinkCall) ReplyExportContainer(notimplemented_ NotImplemented) err return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyKillContainer(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyUpdateContainer(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -917,7 +978,7 @@ func (c__ *VarlinkCall) ReplyKillContainer(notimplemented_ NotImplemented) error return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyRemoveImage(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyPauseContainer(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -925,7 +986,7 @@ func (c__ *VarlinkCall) ReplyRemoveImage(notimplemented_ NotImplemented) error { return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyCreateContainer(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyDeleteStoppedContainers(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -933,7 +994,7 @@ func (c__ *VarlinkCall) ReplyCreateContainer(notimplemented_ NotImplemented) err return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyInspectContainer(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyCreateImage(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -941,7 +1002,7 @@ func (c__ *VarlinkCall) ReplyInspectContainer(notimplemented_ NotImplemented) er return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyAttachToContainer(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyCreateContainer(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -949,7 +1010,7 @@ func (c__ *VarlinkCall) ReplyAttachToContainer(notimplemented_ NotImplemented) e return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyTagImage(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyListContainerProcesses(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -957,23 +1018,23 @@ func (c__ *VarlinkCall) ReplyTagImage(notimplemented_ NotImplemented) error { return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyImportImage(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyListImages(images_ []ImageInList) error { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Images []ImageInList `json:"images"` } - out.Notimplemented = notimplemented_ + out.Images = []ImageInList(images_) return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyPing(ping_ StringResponse) error { +func (c__ *VarlinkCall) ReplyImportImage(id_ string) error { var out struct { - Ping StringResponse `json:"ping"` + Id string `json:"id"` } - out.Ping = ping_ + out.Id = id_ return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyGetContainerLogs(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyListContainers(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -981,7 +1042,7 @@ func (c__ *VarlinkCall) ReplyGetContainerLogs(notimplemented_ NotImplemented) er return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyWaitContainer(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyInspectContainer(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -989,7 +1050,7 @@ func (c__ *VarlinkCall) ReplyWaitContainer(notimplemented_ NotImplemented) error return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyDeleteStoppedContainers(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyListContainerChanges(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -997,7 +1058,7 @@ func (c__ *VarlinkCall) ReplyDeleteStoppedContainers(notimplemented_ NotImplemen return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyCreateFromContainer(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyGetContainerStats(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -1005,15 +1066,23 @@ func (c__ *VarlinkCall) ReplyCreateFromContainer(notimplemented_ NotImplemented) return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyExportImage(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyInspectImage(image_ string) error { var out struct { - Notimplemented NotImplemented `json:"notimplemented"` + Image string `json:"image"` } - out.Notimplemented = notimplemented_ + out.Image = image_ + return c__.Reply(&out) +} + +func (c__ *VarlinkCall) ReplyDeleteUnusedImages(images_ []string) error { + var out struct { + Images []string `json:"images"` + } + out.Images = []string(images_) return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyPullImage(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyKillContainer(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -1021,7 +1090,7 @@ func (c__ *VarlinkCall) ReplyPullImage(notimplemented_ NotImplemented) error { return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyGetContainerStats(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyAttachToContainer(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -1029,7 +1098,7 @@ func (c__ *VarlinkCall) ReplyGetContainerStats(notimplemented_ NotImplemented) e return c__.Reply(&out) } -func (c__ *VarlinkCall) ReplyStopContainer(notimplemented_ NotImplemented) error { +func (c__ *VarlinkCall) ReplyRemoveContainer(notimplemented_ NotImplemented) error { var out struct { Notimplemented NotImplemented `json:"notimplemented"` } @@ -1038,207 +1107,281 @@ func (c__ *VarlinkCall) ReplyStopContainer(notimplemented_ NotImplemented) error } // Dummy methods for all varlink methods -func (s__ *VarlinkInterface) RenameContainer(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("RenameContainer") +func (s__ *VarlinkInterface) UnpauseContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("UnpauseContainer") } -func (s__ *VarlinkInterface) PauseContainer(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("PauseContainer") +func (s__ *VarlinkInterface) GetVersion(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("GetVersion") } -func (s__ *VarlinkInterface) ListContainerProcesses(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("ListContainerProcesses") +func (s__ *VarlinkInterface) ResizeContainerTty(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("ResizeContainerTty") } -func (s__ *VarlinkInterface) CreateImage(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("CreateImage") +func (s__ *VarlinkInterface) StartContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("StartContainer") } -func (s__ *VarlinkInterface) InspectImage(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("InspectImage") +func (s__ *VarlinkInterface) StopContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("StopContainer") } -func (s__ *VarlinkInterface) PushImage(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("PushImage") +func (s__ *VarlinkInterface) Ping(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("Ping") } -func (s__ *VarlinkInterface) SearchImage(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("SearchImage") +func (s__ *VarlinkInterface) PushImage(c__ VarlinkCall, name_ string, tag_ string, tlsverify_ bool) error { + return c__.ReplyMethodNotImplemented("PushImage") } -func (s__ *VarlinkInterface) ListContainerChanges(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("ListContainerChanges") +func (s__ *VarlinkInterface) TagImage(c__ VarlinkCall, name_ string, tagged_ string) error { + return c__.ReplyMethodNotImplemented("TagImage") } -func (s__ *VarlinkInterface) ResizeContainerTty(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("ResizeContainerTty") +func (s__ *VarlinkInterface) SearchImage(c__ VarlinkCall, name_ string, limit_ int64) error { + return c__.ReplyMethodNotImplemented("SearchImage") } -func (s__ *VarlinkInterface) RestartContainer(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("RestartContainer") +func (s__ *VarlinkInterface) ExportImage(c__ VarlinkCall, name_ string, destination_ string, compress_ bool) error { + return c__.ReplyMethodNotImplemented("ExportImage") } -func (s__ *VarlinkInterface) UpdateContainer(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("UpdateContainer") +func (s__ *VarlinkInterface) RenameContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("RenameContainer") } -func (s__ *VarlinkInterface) RemoveContainer(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("RemoveContainer") +func (s__ *VarlinkInterface) WaitContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("WaitContainer") } -func (s__ *VarlinkInterface) HistoryImage(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("HistoryImage") +func (s__ *VarlinkInterface) BuildImage(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("BuildImage") } -func (s__ *VarlinkInterface) ListContainers(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("ListContainers") +func (s__ *VarlinkInterface) HistoryImage(c__ VarlinkCall, name_ string) error { + return c__.ReplyMethodNotImplemented("HistoryImage") } -func (s__ *VarlinkInterface) StartContainer(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("StartContainer") +func (s__ *VarlinkInterface) ExportContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("ExportContainer") } -func (s__ *VarlinkInterface) ListImages(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("ListImages") +func (s__ *VarlinkInterface) RemoveImage(c__ VarlinkCall, name_ string, force_ bool) error { + return c__.ReplyMethodNotImplemented("RemoveImage") } -func (s__ *VarlinkInterface) BuildImage(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("BuildImage") +func (s__ *VarlinkInterface) DeleteStoppedContainers(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("DeleteStoppedContainers") } -func (s__ *VarlinkInterface) GetVersion(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("GetVersion") +func (s__ *VarlinkInterface) CreateImage(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("CreateImage") } -func (s__ *VarlinkInterface) UnpauseContainer(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("UnpauseContainer") +func (s__ *VarlinkInterface) CreateFromContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("CreateFromContainer") } -func (s__ *VarlinkInterface) DeleteUnusedImages(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("DeleteUnusedImages") +func (s__ *VarlinkInterface) PullImage(c__ VarlinkCall, name_ string) error { + return c__.ReplyMethodNotImplemented("PullImage") } -func (s__ *VarlinkInterface) CreateContainer(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("CreateContainer") +func (s__ *VarlinkInterface) GetContainerLogs(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("GetContainerLogs") } -func (s__ *VarlinkInterface) InspectContainer(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("InspectContainer") +func (s__ *VarlinkInterface) RestartContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("RestartContainer") } -func (s__ *VarlinkInterface) ExportContainer(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("ExportContainer") +func (s__ *VarlinkInterface) UpdateContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("UpdateContainer") } -func (s__ *VarlinkInterface) KillContainer(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("KillContainer") +func (s__ *VarlinkInterface) PauseContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("PauseContainer") } -func (s__ *VarlinkInterface) RemoveImage(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("RemoveImage") +func (s__ *VarlinkInterface) CreateContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("CreateContainer") } -func (s__ *VarlinkInterface) Ping(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("Ping") +func (s__ *VarlinkInterface) ListContainerProcesses(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("ListContainerProcesses") } -func (s__ *VarlinkInterface) GetContainerLogs(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("GetContainerLogs") +func (s__ *VarlinkInterface) ListImages(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("ListImages") } -func (s__ *VarlinkInterface) AttachToContainer(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("AttachToContainer") +func (s__ *VarlinkInterface) InspectImage(c__ VarlinkCall, name_ string) error { + return c__.ReplyMethodNotImplemented("InspectImage") } -func (s__ *VarlinkInterface) TagImage(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("TagImage") +func (s__ *VarlinkInterface) DeleteUnusedImages(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("DeleteUnusedImages") } -func (s__ *VarlinkInterface) ImportImage(c__ VarlinkCall) error { +func (s__ *VarlinkInterface) ImportImage(c__ VarlinkCall, source_ string, reference_ string, message_ string, changes_ []string) error { return c__.ReplyMethodNotImplemented("ImportImage") } -func (s__ *VarlinkInterface) GetContainerStats(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("GetContainerStats") +func (s__ *VarlinkInterface) ListContainers(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("ListContainers") } -func (s__ *VarlinkInterface) StopContainer(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("StopContainer") +func (s__ *VarlinkInterface) InspectContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("InspectContainer") } -func (s__ *VarlinkInterface) WaitContainer(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("WaitContainer") +func (s__ *VarlinkInterface) ListContainerChanges(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("ListContainerChanges") } -func (s__ *VarlinkInterface) DeleteStoppedContainers(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("DeleteStoppedContainers") +func (s__ *VarlinkInterface) GetContainerStats(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("GetContainerStats") } -func (s__ *VarlinkInterface) CreateFromContainer(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("CreateFromContainer") +func (s__ *VarlinkInterface) KillContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("KillContainer") } -func (s__ *VarlinkInterface) ExportImage(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("ExportImage") +func (s__ *VarlinkInterface) AttachToContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("AttachToContainer") } -func (s__ *VarlinkInterface) PullImage(c__ VarlinkCall) error { - return c__.ReplyMethodNotImplemented("PullImage") +func (s__ *VarlinkInterface) RemoveContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("RemoveContainer") } // Method call dispatcher func (s__ *VarlinkInterface) VarlinkDispatch(call varlink.Call, methodname string) error { switch methodname { - case "ExportImage": - return s__.ioprojectatomicpodmanInterface.ExportImage(VarlinkCall{call}) + case "KillContainer": + return s__.ioprojectatomicpodmanInterface.KillContainer(VarlinkCall{call}) - case "PullImage": - return s__.ioprojectatomicpodmanInterface.PullImage(VarlinkCall{call}) + case "AttachToContainer": + return s__.ioprojectatomicpodmanInterface.AttachToContainer(VarlinkCall{call}) - case "GetContainerStats": - return s__.ioprojectatomicpodmanInterface.GetContainerStats(VarlinkCall{call}) + case "RemoveContainer": + return s__.ioprojectatomicpodmanInterface.RemoveContainer(VarlinkCall{call}) + + case "GetVersion": + return s__.ioprojectatomicpodmanInterface.GetVersion(VarlinkCall{call}) + + case "ResizeContainerTty": + return s__.ioprojectatomicpodmanInterface.ResizeContainerTty(VarlinkCall{call}) + + case "StartContainer": + return s__.ioprojectatomicpodmanInterface.StartContainer(VarlinkCall{call}) case "StopContainer": return s__.ioprojectatomicpodmanInterface.StopContainer(VarlinkCall{call}) - case "WaitContainer": - return s__.ioprojectatomicpodmanInterface.WaitContainer(VarlinkCall{call}) + case "UnpauseContainer": + return s__.ioprojectatomicpodmanInterface.UnpauseContainer(VarlinkCall{call}) - case "DeleteStoppedContainers": - return s__.ioprojectatomicpodmanInterface.DeleteStoppedContainers(VarlinkCall{call}) + case "Ping": + return s__.ioprojectatomicpodmanInterface.Ping(VarlinkCall{call}) - case "CreateFromContainer": - return s__.ioprojectatomicpodmanInterface.CreateFromContainer(VarlinkCall{call}) + case "TagImage": + var in struct { + Name string `json:"name"` + Tagged string `json:"tagged"` + } + err := call.GetParameters(&in) + if err != nil { + return call.ReplyInvalidParameter("parameters") + } + return s__.ioprojectatomicpodmanInterface.TagImage(VarlinkCall{call}, in.Name, in.Tagged) + + case "SearchImage": + var in struct { + Name string `json:"name"` + Limit int64 `json:"limit"` + } + err := call.GetParameters(&in) + if err != nil { + return call.ReplyInvalidParameter("parameters") + } + return s__.ioprojectatomicpodmanInterface.SearchImage(VarlinkCall{call}, in.Name, in.Limit) + + case "ExportImage": + var in struct { + Name string `json:"name"` + Destination string `json:"destination"` + Compress bool `json:"compress"` + } + err := call.GetParameters(&in) + if err != nil { + return call.ReplyInvalidParameter("parameters") + } + return s__.ioprojectatomicpodmanInterface.ExportImage(VarlinkCall{call}, in.Name, in.Destination, in.Compress) case "RenameContainer": return s__.ioprojectatomicpodmanInterface.RenameContainer(VarlinkCall{call}) - case "PauseContainer": - return s__.ioprojectatomicpodmanInterface.PauseContainer(VarlinkCall{call}) - - case "ListContainerProcesses": - return s__.ioprojectatomicpodmanInterface.ListContainerProcesses(VarlinkCall{call}) + case "WaitContainer": + return s__.ioprojectatomicpodmanInterface.WaitContainer(VarlinkCall{call}) - case "CreateImage": - return s__.ioprojectatomicpodmanInterface.CreateImage(VarlinkCall{call}) + case "BuildImage": + return s__.ioprojectatomicpodmanInterface.BuildImage(VarlinkCall{call}) - case "InspectImage": - return s__.ioprojectatomicpodmanInterface.InspectImage(VarlinkCall{call}) + case "HistoryImage": + var in struct { + Name string `json:"name"` + } + err := call.GetParameters(&in) + if err != nil { + return call.ReplyInvalidParameter("parameters") + } + return s__.ioprojectatomicpodmanInterface.HistoryImage(VarlinkCall{call}, in.Name) case "PushImage": - return s__.ioprojectatomicpodmanInterface.PushImage(VarlinkCall{call}) + var in struct { + Name string `json:"name"` + Tag string `json:"tag"` + Tlsverify bool `json:"tlsverify"` + } + err := call.GetParameters(&in) + if err != nil { + return call.ReplyInvalidParameter("parameters") + } + return s__.ioprojectatomicpodmanInterface.PushImage(VarlinkCall{call}, in.Name, in.Tag, in.Tlsverify) - case "SearchImage": - return s__.ioprojectatomicpodmanInterface.SearchImage(VarlinkCall{call}) + case "ExportContainer": + return s__.ioprojectatomicpodmanInterface.ExportContainer(VarlinkCall{call}) - case "HistoryImage": - return s__.ioprojectatomicpodmanInterface.HistoryImage(VarlinkCall{call}) + case "RemoveImage": + var in struct { + Name string `json:"name"` + Force bool `json:"force"` + } + err := call.GetParameters(&in) + if err != nil { + return call.ReplyInvalidParameter("parameters") + } + return s__.ioprojectatomicpodmanInterface.RemoveImage(VarlinkCall{call}, in.Name, in.Force) - case "ListContainerChanges": - return s__.ioprojectatomicpodmanInterface.ListContainerChanges(VarlinkCall{call}) + case "CreateImage": + return s__.ioprojectatomicpodmanInterface.CreateImage(VarlinkCall{call}) - case "ResizeContainerTty": - return s__.ioprojectatomicpodmanInterface.ResizeContainerTty(VarlinkCall{call}) + case "CreateFromContainer": + return s__.ioprojectatomicpodmanInterface.CreateFromContainer(VarlinkCall{call}) + + case "PullImage": + var in struct { + Name string `json:"name"` + } + err := call.GetParameters(&in) + if err != nil { + return call.ReplyInvalidParameter("parameters") + } + return s__.ioprojectatomicpodmanInterface.PullImage(VarlinkCall{call}, in.Name) + + case "GetContainerLogs": + return s__.ioprojectatomicpodmanInterface.GetContainerLogs(VarlinkCall{call}) case "RestartContainer": return s__.ioprojectatomicpodmanInterface.RestartContainer(VarlinkCall{call}) @@ -1246,59 +1389,58 @@ func (s__ *VarlinkInterface) VarlinkDispatch(call varlink.Call, methodname strin case "UpdateContainer": return s__.ioprojectatomicpodmanInterface.UpdateContainer(VarlinkCall{call}) - case "RemoveContainer": - return s__.ioprojectatomicpodmanInterface.RemoveContainer(VarlinkCall{call}) + case "PauseContainer": + return s__.ioprojectatomicpodmanInterface.PauseContainer(VarlinkCall{call}) - case "ListContainers": - return s__.ioprojectatomicpodmanInterface.ListContainers(VarlinkCall{call}) + case "DeleteStoppedContainers": + return s__.ioprojectatomicpodmanInterface.DeleteStoppedContainers(VarlinkCall{call}) - case "StartContainer": - return s__.ioprojectatomicpodmanInterface.StartContainer(VarlinkCall{call}) + case "CreateContainer": + return s__.ioprojectatomicpodmanInterface.CreateContainer(VarlinkCall{call}) + + case "ListContainerProcesses": + return s__.ioprojectatomicpodmanInterface.ListContainerProcesses(VarlinkCall{call}) case "ListImages": return s__.ioprojectatomicpodmanInterface.ListImages(VarlinkCall{call}) - case "BuildImage": - return s__.ioprojectatomicpodmanInterface.BuildImage(VarlinkCall{call}) - - case "GetVersion": - return s__.ioprojectatomicpodmanInterface.GetVersion(VarlinkCall{call}) - - case "UnpauseContainer": - return s__.ioprojectatomicpodmanInterface.UnpauseContainer(VarlinkCall{call}) - case "DeleteUnusedImages": return s__.ioprojectatomicpodmanInterface.DeleteUnusedImages(VarlinkCall{call}) - case "CreateContainer": - return s__.ioprojectatomicpodmanInterface.CreateContainer(VarlinkCall{call}) + case "ImportImage": + var in struct { + Source string `json:"source"` + Reference string `json:"reference"` + Message string `json:"message"` + Changes []string `json:"changes"` + } + err := call.GetParameters(&in) + if err != nil { + return call.ReplyInvalidParameter("parameters") + } + return s__.ioprojectatomicpodmanInterface.ImportImage(VarlinkCall{call}, in.Source, in.Reference, in.Message, []string(in.Changes)) + + case "ListContainers": + return s__.ioprojectatomicpodmanInterface.ListContainers(VarlinkCall{call}) case "InspectContainer": return s__.ioprojectatomicpodmanInterface.InspectContainer(VarlinkCall{call}) - case "ExportContainer": - return s__.ioprojectatomicpodmanInterface.ExportContainer(VarlinkCall{call}) - - case "KillContainer": - return s__.ioprojectatomicpodmanInterface.KillContainer(VarlinkCall{call}) - - case "RemoveImage": - return s__.ioprojectatomicpodmanInterface.RemoveImage(VarlinkCall{call}) - - case "Ping": - return s__.ioprojectatomicpodmanInterface.Ping(VarlinkCall{call}) - - case "GetContainerLogs": - return s__.ioprojectatomicpodmanInterface.GetContainerLogs(VarlinkCall{call}) - - case "AttachToContainer": - return s__.ioprojectatomicpodmanInterface.AttachToContainer(VarlinkCall{call}) + case "ListContainerChanges": + return s__.ioprojectatomicpodmanInterface.ListContainerChanges(VarlinkCall{call}) - case "TagImage": - return s__.ioprojectatomicpodmanInterface.TagImage(VarlinkCall{call}) + case "GetContainerStats": + return s__.ioprojectatomicpodmanInterface.GetContainerStats(VarlinkCall{call}) - case "ImportImage": - return s__.ioprojectatomicpodmanInterface.ImportImage(VarlinkCall{call}) + case "InspectImage": + var in struct { + Name string `json:"name"` + } + err := call.GetParameters(&in) + if err != nil { + return call.ReplyInvalidParameter("parameters") + } + return s__.ioprojectatomicpodmanInterface.InspectImage(VarlinkCall{call}, in.Name) default: return call.ReplyMethodNotFound(methodname) @@ -1315,6 +1457,8 @@ func (s__ *VarlinkInterface) VarlinkGetDescription() string { return `# Podman Service Interface interface io.projectatomic.podman + +# Version is the structure returned by GetVersion type Version ( version: string, go_version: string, @@ -1331,6 +1475,40 @@ type StringResponse ( message: string ) +# ImageInList describes the structure that is returned in +# ListImages. +type ImageInList ( + id: string, + parentId: string, + repoTags: []string, + repoDigests: []string, + created: string, + size: int, + virtualSize: int, + containers: int, + labels: [string]string +) + +# ImageHistory describes the returned structure from ImageHistory. +type ImageHistory ( + id: string, + created: string, + createdBy: string, + tags: []string, + size: int, + comment: string +) + +# ImageSearch is the returned structure for SearchImage. It is returned +# in arrary form. +type ImageSearch ( + description: string, + is_official: bool, + is_automated: bool, + name: string, + star_count: int +) + # System method Ping() -> (ping: StringResponse) method GetVersion() -> (version: Version) @@ -1359,24 +1537,27 @@ method RemoveContainer() -> (notimplemented: NotImplemented) method DeleteStoppedContainers() -> (notimplemented: NotImplemented) # Images -method ListImages() -> (notimplemented: NotImplemented) +method ListImages() -> (images: []ImageInList) method BuildImage() -> (notimplemented: NotImplemented) method CreateImage() -> (notimplemented: NotImplemented) -method InspectImage() -> (notimplemented: NotImplemented) -method HistoryImage() -> (notimplemented: NotImplemented) -method PushImage() -> (notimplemented: NotImplemented) -method TagImage() -> (notimplemented: NotImplemented) -method RemoveImage() -> (notimplemented: NotImplemented) -method SearchImage() -> (notimplemented: NotImplemented) -method DeleteUnusedImages() -> (notimplemented: NotImplemented) +method InspectImage(name: string) -> (image: string) +method HistoryImage(name: string) -> (history: []ImageHistory) +method PushImage(name: string, tag: string, tlsverify: bool) -> () +method TagImage(name: string, tagged: string) -> () +method RemoveImage(name: string, force: bool) -> () +method SearchImage(name: string, limit: int) -> (images: []ImageSearch) +method DeleteUnusedImages() -> (images: []string) method CreateFromContainer() -> (notimplemented: NotImplemented) -method ImportImage() -> (notimplemented: NotImplemented) -method ExportImage() -> (notimplemented: NotImplemented) -method PullImage() -> (notimplemented: NotImplemented) +method ImportImage(source: string, reference: string, message: string, changes: []string) -> (id: string) +method ExportImage(name: string, destination: string, compress: bool) -> () +method PullImage(name: string) -> (id: string) # Something failed error ActionFailed (reason: string) +error ImageNotFound (imagename: string) +error ErrorOccurred (reason: string) +error RuntimeError (reason: string) ` } diff --git a/cmd/podman/wait.go b/cmd/podman/wait.go index 2b2a07738..142e0e599 100644 --- a/cmd/podman/wait.go +++ b/cmd/podman/wait.go @@ -5,6 +5,7 @@ import ( "os" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" "github.com/urfave/cli" ) @@ -31,7 +32,7 @@ func waitCmd(c *cli.Context) error { return errors.Errorf("you must provide at least one container name or id") } - runtime, err := getRuntime(c) + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "error creating libpod runtime") } diff --git a/contrib/libpodpy/__init__.py b/contrib/libpodpy/__init__.py new file mode 100644 index 000000000..8c2caf670 --- /dev/null +++ b/contrib/libpodpy/__init__.py @@ -0,0 +1,4 @@ + + +#__version__ = version +__title__ = 'libpod'
\ No newline at end of file diff --git a/contrib/libpodpy/client.py b/contrib/libpodpy/client.py new file mode 100644 index 000000000..d9bac6dbb --- /dev/null +++ b/contrib/libpodpy/client.py @@ -0,0 +1,45 @@ + +from varlink import Client +from libpodpy.images import Images +from libpodpy.system import System +from libpodpy.containers import Containers + +class LibpodClient(object): + + + """ + A client for communicating with a Docker server. + + Example: + + >>> from libpodpy import client + >>> c = client.LibpodClient("unix:/run/podman/io.projectatomic.podman") + + Args: + Requires the varlink URI for libpod + """ + + def __init__(self, varlink_uri): + c = Client(address=varlink_uri) + self.conn = c.open("io.projectatomic.podman") + + @property + def images(self): + """ + An object for managing images through libpod + """ + return Images(self.conn) + + @property + def system(self): + """ + An object for system related calls through libpod + """ + return System(self.conn) + + @property + def containers(self): + """ + An object for managing containers through libpod + """ + return Containers(self.conn) diff --git a/contrib/libpodpy/containers.py b/contrib/libpodpy/containers.py new file mode 100644 index 000000000..921bf0491 --- /dev/null +++ b/contrib/libpodpy/containers.py @@ -0,0 +1,8 @@ + +class Containers(object): + + def __init__(self, client): + self.client = client + + def List(self): + pass
\ No newline at end of file diff --git a/contrib/libpodpy/images.py b/contrib/libpodpy/images.py new file mode 100644 index 000000000..f54736a21 --- /dev/null +++ b/contrib/libpodpy/images.py @@ -0,0 +1,15 @@ + +class Images(object): + """ + The Images class deals with image related functions for libpod. + """ + + def __init__(self, client): + self.client = client + + def List(self): + """ + Lists all images in the libpod image store + return: a list of ImageList objects + """ + return self.client.ListImages() diff --git a/contrib/libpodpy/system.py b/contrib/libpodpy/system.py new file mode 100644 index 000000000..563cc6566 --- /dev/null +++ b/contrib/libpodpy/system.py @@ -0,0 +1,10 @@ + +class System(object): + def __init__(self, client): + self.client = client + + def Ping(self): + return self.client.Ping() + + def Version(self): + return self.client.GetVersion() diff --git a/libpod/image/image.go b/libpod/image/image.go index 4d481c8e5..b2dd22b82 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -274,6 +274,15 @@ func (i *Image) Names() []string { return i.image.Names } +// RepoDigests returns a string array of repodigests associated with the image +func (i *Image) RepoDigests() []string { + var repoDigests []string + for _, name := range i.Names() { + repoDigests = append(repoDigests, strings.SplitN(name, ":", 2)[0]+"@"+i.Digest().String()) + } + return repoDigests +} + // Created returns the time the image was created func (i *Image) Created() time.Time { return i.image.Created @@ -778,3 +787,18 @@ func splitString(input string) string { func (i *Image) InputIsID() bool { return strings.HasPrefix(i.ID(), i.InputName) } + +// Containers a list of container IDs associated with the image +func (i *Image) Containers() ([]string, error) { + containers, err := i.imageruntime.store.Containers() + if err != nil { + return nil, err + } + var imageContainers []string + for _, c := range containers { + if c.ImageID == i.ID() { + imageContainers = append(imageContainers, c.ID) + } + } + return imageContainers, err +} diff --git a/libpod/version.go b/libpod/version.go index 9bc4fe616..cb3e6b16d 100644 --- a/libpod/version.go +++ b/libpod/version.go @@ -4,7 +4,6 @@ import ( "runtime" "strconv" - "github.com/projectatomic/libpod/cmd/podman/ioprojectatomicpodman" podmanVersion "github.com/projectatomic/libpod/version" ) @@ -20,7 +19,6 @@ var ( //Version is an output struct for varlink type Version struct { - ioprojectatomicpodman.VarlinkInterface Version string GoVersion string GitCommit string diff --git a/pkg/util/utils.go b/pkg/util/utils.go index edcf63f80..1bbfe30d3 100644 --- a/pkg/util/utils.go +++ b/pkg/util/utils.go @@ -5,6 +5,7 @@ import ( "strings" "github.com/containers/image/types" + "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "golang.org/x/crypto/ssh/terminal" ) @@ -54,3 +55,68 @@ func StringInSlice(s string, sl []string) bool { } return false } + +// GetImageConfig converts the --change flag values in the format "CMD=/bin/bash USER=example" +// to a type v1.ImageConfig +func GetImageConfig(changes []string) (v1.ImageConfig, error) { + // USER=value | EXPOSE=value | ENV=value | ENTRYPOINT=value | + // CMD=value | VOLUME=value | WORKDIR=value | LABEL=key=value | STOPSIGNAL=value + + var ( + user string + env []string + entrypoint []string + cmd []string + workingDir string + stopSignal string + ) + + exposedPorts := make(map[string]struct{}) + volumes := make(map[string]struct{}) + labels := make(map[string]string) + + for _, ch := range changes { + pair := strings.Split(ch, "=") + if len(pair) == 1 { + return v1.ImageConfig{}, errors.Errorf("no value given for instruction %q", ch) + } + switch pair[0] { + case "USER": + user = pair[1] + case "EXPOSE": + var st struct{} + exposedPorts[pair[1]] = st + case "ENV": + env = append(env, pair[1]) + case "ENTRYPOINT": + entrypoint = append(entrypoint, pair[1]) + case "CMD": + cmd = append(cmd, pair[1]) + case "VOLUME": + var st struct{} + volumes[pair[1]] = st + case "WORKDIR": + workingDir = pair[1] + case "LABEL": + if len(pair) == 3 { + labels[pair[1]] = pair[2] + } else { + labels[pair[1]] = "" + } + case "STOPSIGNAL": + stopSignal = pair[1] + } + } + + return v1.ImageConfig{ + User: user, + ExposedPorts: exposedPorts, + Env: env, + Entrypoint: entrypoint, + Cmd: cmd, + Volumes: volumes, + WorkingDir: workingDir, + Labels: labels, + StopSignal: stopSignal, + }, nil +} diff --git a/pkg/varlinkapi/config.go b/pkg/varlinkapi/config.go index 167270f09..3c6a3311c 100644 --- a/pkg/varlinkapi/config.go +++ b/pkg/varlinkapi/config.go @@ -1,14 +1,18 @@ package varlinkapi -import "github.com/projectatomic/libpod/cmd/podman/ioprojectatomicpodman" +import ( + ioprojectatomicpodman "github.com/projectatomic/libpod/cmd/podman/varlink" + "github.com/urfave/cli" +) // LibpodAPI is the basic varlink struct for libpod type LibpodAPI struct { + Cli *cli.Context ioprojectatomicpodman.VarlinkInterface } -var ( - lp = LibpodAPI{} - // VarlinkLibpod instantiation - VarlinkLibpod = ioprojectatomicpodman.VarlinkNew(&lp) -) +// New creates a new varlink client +func New(cli *cli.Context) *ioprojectatomicpodman.VarlinkInterface { + lp := LibpodAPI{Cli: cli} + return ioprojectatomicpodman.VarlinkNew(&lp) +} diff --git a/pkg/varlinkapi/containers.go b/pkg/varlinkapi/containers.go index e58cab497..bd406dda2 100644 --- a/pkg/varlinkapi/containers.go +++ b/pkg/varlinkapi/containers.go @@ -1,7 +1,7 @@ package varlinkapi import ( - "github.com/projectatomic/libpod/cmd/podman/ioprojectatomicpodman" + ioprojectatomicpodman "github.com/projectatomic/libpod/cmd/podman/varlink" ) // ListContainers ... diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go index 1de54e43b..29fe803ae 100644 --- a/pkg/varlinkapi/images.go +++ b/pkg/varlinkapi/images.go @@ -1,75 +1,285 @@ package varlinkapi import ( - "github.com/projectatomic/libpod/cmd/podman/ioprojectatomicpodman" + "encoding/json" + "fmt" + + "github.com/containers/image/docker" + "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" + ioprojectatomicpodman "github.com/projectatomic/libpod/cmd/podman/varlink" + "github.com/projectatomic/libpod/libpod/image" + sysreg "github.com/projectatomic/libpod/pkg/registries" + "github.com/projectatomic/libpod/pkg/util" ) -// ListImages ... +// ListImages lists all the images in the store +// It requires no inputs. func (i *LibpodAPI) ListImages(call ioprojectatomicpodman.VarlinkCall) error { - return call.ReplyMethodNotImplemented("ListImages") + runtime, err := libpodruntime.GetRuntime(i.Cli) + if err != nil { + return call.ReplyRuntimeError(err.Error()) + } + images, err := runtime.ImageRuntime().GetImages() + if err != nil { + return call.ReplyErrorOccurred(fmt.Sprintf("unable to get list of images %q", err)) + } + var imageList []ioprojectatomicpodman.ImageInList + for _, image := range images { + //size, _:= image.Size(getContext()) + labels, _ := image.Labels(getContext()) + containers, _ := image.Containers() + + i := ioprojectatomicpodman.ImageInList{ + Id: image.ID(), + ParentId: image.Parent, + RepoTags: image.Names(), + RepoDigests: image.RepoDigests(), + Created: image.Created().String(), + //Size: size, + VirtualSize: image.VirtualSize, + Containers: int64(len(containers)), + Labels: labels, + } + imageList = append(imageList, i) + } + return call.ReplyListImages(imageList) } // BuildImage ... +// TODO Waiting for buildah to be vendored into libpod to do this only one func (i *LibpodAPI) BuildImage(call ioprojectatomicpodman.VarlinkCall) error { return call.ReplyMethodNotImplemented("BuildImage") } // CreateImage ... +// TODO With Pull being added, should we skip Create? func (i *LibpodAPI) CreateImage(call ioprojectatomicpodman.VarlinkCall) error { return call.ReplyMethodNotImplemented("CreateImage") } -// InspectImage ... -func (i *LibpodAPI) InspectImage(call ioprojectatomicpodman.VarlinkCall) error { - return call.ReplyMethodNotImplemented("InspectImage") +// InspectImage returns an image's inspect information as a string that can be serialized. +// Requires an image ID or name +func (i *LibpodAPI) InspectImage(call ioprojectatomicpodman.VarlinkCall, name string) error { + runtime, err := libpodruntime.GetRuntime(i.Cli) + if err != nil { + return call.ReplyRuntimeError(err.Error()) + } + newImage, err := runtime.ImageRuntime().NewFromLocal(name) + if err != nil { + return call.ReplyImageNotFound(name) + } + inspectInfo, err := newImage.Inspect(getContext()) + b, err := json.Marshal(inspectInfo) + if err != nil { + return call.ReplyErrorOccurred(fmt.Sprintf("unable to serialize")) + } + return call.ReplyInspectImage(string(b)) } -// HistoryImage ... -func (i *LibpodAPI) HistoryImage(call ioprojectatomicpodman.VarlinkCall) error { - return call.ReplyMethodNotImplemented("HistoryImage") +// HistoryImage returns the history of the image's layers +// Requires an image or name +func (i *LibpodAPI) HistoryImage(call ioprojectatomicpodman.VarlinkCall, name string) error { + runtime, err := libpodruntime.GetRuntime(i.Cli) + if err != nil { + return call.ReplyRuntimeError(err.Error()) + } + newImage, err := runtime.ImageRuntime().NewFromLocal(name) + if err != nil { + return call.ReplyImageNotFound(name) + } + history, layerInfos, err := newImage.History(getContext()) + if err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + var histories []ioprojectatomicpodman.ImageHistory + for i, h := range history { + imageHistory := ioprojectatomicpodman.ImageHistory{ + Id: newImage.ID(), + Created: h.Created.String(), + CreatedBy: h.CreatedBy, + Tags: newImage.Names(), + Size: layerInfos[i].Size, + Comment: h.Comment, + } + histories = append(histories, imageHistory) + } + return call.ReplyHistoryImage(histories) } -// PushImage ... -func (i *LibpodAPI) PushImage(call ioprojectatomicpodman.VarlinkCall) error { - return call.ReplyMethodNotImplemented("PushImage") +// PushImage pushes an local image to registry +// TODO We need to add options for signing, credentials, and tls +func (i *LibpodAPI) PushImage(call ioprojectatomicpodman.VarlinkCall, name, tag string, tlsVerify bool) error { + runtime, err := libpodruntime.GetRuntime(i.Cli) + if err != nil { + return call.ReplyRuntimeError(err.Error()) + } + newImage, err := runtime.ImageRuntime().NewFromLocal(name) + if err != nil { + return call.ReplyImageNotFound(err.Error()) + } + destname := name + if tag != "" { + destname = tag + } + + dockerRegistryOptions := image.DockerRegistryOptions{ + DockerInsecureSkipTLSVerify: !tlsVerify, + } + + so := image.SigningOptions{} + + if err := newImage.PushImage(getContext(), destname, "", "", "", nil, false, so, &dockerRegistryOptions); err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + return call.ReplyPushImage() } -// TagImage ... -func (i *LibpodAPI) TagImage(call ioprojectatomicpodman.VarlinkCall) error { - return call.ReplyMethodNotImplemented("TagImage") +// TagImage accepts an image name and tag as strings and tags an image in the local store. +func (i *LibpodAPI) TagImage(call ioprojectatomicpodman.VarlinkCall, name, tag string) error { + runtime, err := libpodruntime.GetRuntime(i.Cli) + if err != nil { + return call.ReplyRuntimeError(err.Error()) + } + newImage, err := runtime.ImageRuntime().NewFromLocal(name) + if err != nil { + return call.ReplyImageNotFound(name) + } + if err := newImage.TagImage(tag); err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + return call.ReplyTagImage() } -// RemoveImage ... -func (i *LibpodAPI) RemoveImage(call ioprojectatomicpodman.VarlinkCall) error { - return call.ReplyMethodNotImplemented("RemoveImage") +// RemoveImage accepts a image name or ID as a string and force bool to determine if it should +// remove the image even if being used by stopped containers +func (i *LibpodAPI) RemoveImage(call ioprojectatomicpodman.VarlinkCall, name string, force bool) error { + runtime, err := libpodruntime.GetRuntime(i.Cli) + if err != nil { + return call.ReplyRuntimeError(err.Error()) + } + newImage, err := runtime.ImageRuntime().NewFromLocal(name) + if err != nil { + return call.ReplyImageNotFound(name) + } + if err := newImage.Remove(force); err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + return call.ReplyRemoveImage() } -// SearchImage ... -func (i *LibpodAPI) SearchImage(call ioprojectatomicpodman.VarlinkCall) error { - return call.ReplyMethodNotImplemented("SearchImage") +// SearchImage searches all registries configured in /etc/containers/registries.conf for an image +// Requires an image name and a search limit as int +func (i *LibpodAPI) SearchImage(call ioprojectatomicpodman.VarlinkCall, name string, limit int64) error { + sc := image.GetSystemContext("", "", false) + registries, err := sysreg.GetRegistries() + if err != nil { + return call.ReplyErrorOccurred(fmt.Sprintf("unable to get system registries: %q", err)) + } + var imageResults []ioprojectatomicpodman.ImageSearch + for _, reg := range registries { + results, err := docker.SearchRegistry(getContext(), sc, reg, name, int(limit)) + if err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + for _, result := range results { + i := ioprojectatomicpodman.ImageSearch{ + Description: result.Description, + Is_official: result.IsOfficial, + Is_automated: result.IsAutomated, + Name: result.Name, + Star_count: int64(result.StarCount), + } + imageResults = append(imageResults, i) + } + } + return call.ReplySearchImage(imageResults) } -// DeleteUnusedImages ... +// DeleteUnusedImages deletes any images that do not have containers associated with it. +// TODO Filters are not implemented func (i *LibpodAPI) DeleteUnusedImages(call ioprojectatomicpodman.VarlinkCall) error { - return call.ReplyMethodNotImplemented("DeleteUnusedImages") + runtime, err := libpodruntime.GetRuntime(i.Cli) + if err != nil { + return call.ReplyRuntimeError(err.Error()) + } + images, err := runtime.ImageRuntime().GetImages() + if err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + var deletedImages []string + for _, img := range images { + containers, err := img.Containers() + if err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + if len(containers) == 0 { + if err := img.Remove(false); err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + deletedImages = append(deletedImages, img.ID()) + } + } + return call.ReplyDeleteUnusedImages(deletedImages) } // CreateFromContainer ... +// TODO This must wait until buildah is properly vendored into libpod func (i *LibpodAPI) CreateFromContainer(call ioprojectatomicpodman.VarlinkCall) error { return call.ReplyMethodNotImplemented("CreateFromContainer") } -// ImportImage ... -func (i *LibpodAPI) ImportImage(call ioprojectatomicpodman.VarlinkCall) error { - return call.ReplyMethodNotImplemented("ImportImage") +// ImportImage imports an image from a tarball to the image store +func (i *LibpodAPI) ImportImage(call ioprojectatomicpodman.VarlinkCall, source, reference, message string, changes []string) error { + runtime, err := libpodruntime.GetRuntime(i.Cli) + if err != nil { + return call.ReplyRuntimeError(err.Error()) + } + configChanges, err := util.GetImageConfig(changes) + if err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + history := []v1.History{ + {Comment: message}, + } + config := v1.Image{ + Config: configChanges, + History: history, + } + newImage, err := runtime.ImageRuntime().Import(getContext(), source, reference, nil, image.SigningOptions{}, config) + if err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + return call.ReplyImportImage(newImage.ID()) } -// ExportImage ... -func (i *LibpodAPI) ExportImage(call ioprojectatomicpodman.VarlinkCall) error { - return call.ReplyMethodNotImplemented("ExportImage") +// ExportImage exports an image to the provided destination +// destination must have the transport type!! +func (i *LibpodAPI) ExportImage(call ioprojectatomicpodman.VarlinkCall, name, destination string, compress bool) error { + runtime, err := libpodruntime.GetRuntime(i.Cli) + if err != nil { + return call.ReplyRuntimeError(err.Error()) + } + newImage, err := runtime.ImageRuntime().NewFromLocal(name) + if err != nil { + return call.ReplyImageNotFound(name) + } + if err := newImage.PushImage(getContext(), destination, "", "", "", nil, compress, image.SigningOptions{}, &image.DockerRegistryOptions{}); err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + return call.ReplyExportImage() } -// PullImage ... -func (i *LibpodAPI) PullImage(call ioprojectatomicpodman.VarlinkCall) error { - return call.ReplyMethodNotImplemented("PullImage") +// PullImage pulls an image from a registry to the image store. +// TODO This implementation is incomplete +func (i *LibpodAPI) PullImage(call ioprojectatomicpodman.VarlinkCall, name string) error { + runtime, err := libpodruntime.GetRuntime(i.Cli) + if err != nil { + return call.ReplyRuntimeError(err.Error()) + } + newImage, err := runtime.ImageRuntime().New(getContext(), name, "", "", nil, &image.DockerRegistryOptions{}, image.SigningOptions{}, true, false) + if err != nil { + return call.ReplyErrorOccurred(fmt.Sprintf("unable to pull %s", name)) + } + return call.ReplyPullImage(newImage.ID()) } diff --git a/pkg/varlinkapi/system.go b/pkg/varlinkapi/system.go index c343f1245..976dfc682 100644 --- a/pkg/varlinkapi/system.go +++ b/pkg/varlinkapi/system.go @@ -1,7 +1,7 @@ package varlinkapi import ( - "github.com/projectatomic/libpod/cmd/podman/ioprojectatomicpodman" + ioprojectatomicpodman "github.com/projectatomic/libpod/cmd/podman/varlink" "github.com/projectatomic/libpod/libpod" ) diff --git a/pkg/varlinkapi/util.go b/pkg/varlinkapi/util.go new file mode 100644 index 000000000..ff0fb6ecb --- /dev/null +++ b/pkg/varlinkapi/util.go @@ -0,0 +1,10 @@ +package varlinkapi + +import ( + "context" +) + +// getContext returns a non-nil, empty context +func getContext() context.Context { + return context.TODO() +} diff --git a/varlink_client.py b/varlink_client.py deleted file mode 100644 index 7446e3012..000000000 --- a/varlink_client.py +++ /dev/null @@ -1,9 +0,0 @@ -from varlink import (Client, VarlinkError) -import json - -address = "unix:/run/podman/io.projectatomic.podman" - -with Client(address=address) as client: - podman = client.open('io.projectatomic.podman') - response = podman.GetVersion() - print(json.dumps(response, indent=4, separators=(',', ': ')))
\ No newline at end of file |