mirror of
https://github.com/containers/podman.git
synced 2025-06-29 15:08:09 +08:00
Merge pull request #5571 from baude/v2exists
podmanv2 container exists|wait
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -29,3 +29,4 @@ podman*.tar.gz
|
|||||||
contrib/spec/podman.spec
|
contrib/spec/podman.spec
|
||||||
*.rpm
|
*.rpm
|
||||||
*.coverprofile
|
*.coverprofile
|
||||||
|
/cmd/podmanV2/podmanV2
|
||||||
|
42
cmd/podmanV2/containers/exists.go
Normal file
42
cmd/podmanV2/containers/exists.go
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package containers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/containers/libpod/cmd/podmanV2/registry"
|
||||||
|
"github.com/containers/libpod/pkg/domain/entities"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
containerExistsDescription = `If the named container exists in local storage, podman container exists exits with 0, otherwise the exit code will be 1.`
|
||||||
|
|
||||||
|
existsCommand = &cobra.Command{
|
||||||
|
Use: "exists CONTAINER",
|
||||||
|
Short: "Check if a container exists in local storage",
|
||||||
|
Long: containerExistsDescription,
|
||||||
|
Example: `podman container exists containerID
|
||||||
|
podman container exists myctr || podman run --name myctr [etc...]`,
|
||||||
|
RunE: exists,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||||
|
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||||
|
Command: existsCommand,
|
||||||
|
Parent: containerCmd,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func exists(cmd *cobra.Command, args []string) error {
|
||||||
|
response, err := registry.ContainerEngine().ContainerExists(context.Background(), args[0])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if !response.Value {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
82
cmd/podmanV2/containers/wait.go
Normal file
82
cmd/podmanV2/containers/wait.go
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
package containers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/containers/libpod/cmd/podmanV2/registry"
|
||||||
|
"github.com/containers/libpod/libpod/define"
|
||||||
|
"github.com/containers/libpod/pkg/domain/entities"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
waitDescription = `Block until one or more containers stop and then print their exit codes.
|
||||||
|
`
|
||||||
|
waitCommand = &cobra.Command{
|
||||||
|
Use: "wait [flags] CONTAINER [CONTAINER...]",
|
||||||
|
Short: "Block on one or more containers",
|
||||||
|
Long: waitDescription,
|
||||||
|
RunE: wait,
|
||||||
|
Example: `podman wait --latest
|
||||||
|
podman wait --interval 5000 ctrID
|
||||||
|
podman wait ctrID1 ctrID2`,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
waitFlags = entities.WaitOptions{}
|
||||||
|
waitCondition string
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||||
|
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||||
|
Command: waitCommand,
|
||||||
|
Parent: containerCmd,
|
||||||
|
})
|
||||||
|
|
||||||
|
flags := waitCommand.Flags()
|
||||||
|
flags.DurationVarP(&waitFlags.Interval, "interval", "i", time.Duration(250), "Milliseconds to wait before polling for completion")
|
||||||
|
flags.BoolVarP(&waitFlags.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
|
||||||
|
flags.StringVar(&waitCondition, "condition", "stopped", "Condition to wait on")
|
||||||
|
if registry.EngineOpts.EngineMode == entities.ABIMode {
|
||||||
|
// TODO: This is the same as V1. We could skip creating the flag altogether in V2...
|
||||||
|
_ = flags.MarkHidden("latest")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func wait(cmd *cobra.Command, args []string) error {
|
||||||
|
var (
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if waitFlags.Latest && len(args) > 0 {
|
||||||
|
return errors.New("cannot combine latest flag and arguments")
|
||||||
|
}
|
||||||
|
if waitFlags.Interval == 0 {
|
||||||
|
return errors.New("interval must be greater then 0")
|
||||||
|
}
|
||||||
|
|
||||||
|
waitFlags.Condition, err = define.StringToContainerStatus(waitCondition)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
responses, err := registry.ContainerEngine().ContainerWait(context.Background(), args, waitFlags)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, r := range responses {
|
||||||
|
if r.Error == nil {
|
||||||
|
fmt.Println(r.Id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, r := range responses {
|
||||||
|
if r.Error != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
@ -52,7 +52,7 @@ func init() {
|
|||||||
flags.BoolVarP(&inspectOpts.Size, "size", "s", false, "Display total file size")
|
flags.BoolVarP(&inspectOpts.Size, "size", "s", false, "Display total file size")
|
||||||
flags.StringVarP(&inspectOpts.Format, "format", "f", "", "Change the output format to a Go template")
|
flags.StringVarP(&inspectOpts.Format, "format", "f", "", "Change the output format to a Go template")
|
||||||
|
|
||||||
if registry.GlobalFlags.EngineMode == entities.ABIMode {
|
if registry.EngineOpts.EngineMode == entities.ABIMode {
|
||||||
// TODO: This is the same as V1. We could skip creating the flag altogether in V2...
|
// TODO: This is the same as V1. We could skip creating the flag altogether in V2...
|
||||||
_ = flags.MarkHidden("latest")
|
_ = flags.MarkHidden("latest")
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
_ "github.com/containers/libpod/cmd/podmanV2/containers"
|
_ "github.com/containers/libpod/cmd/podmanV2/containers"
|
||||||
_ "github.com/containers/libpod/cmd/podmanV2/images"
|
_ "github.com/containers/libpod/cmd/podmanV2/images"
|
||||||
@ -31,17 +32,19 @@ func initCobra() {
|
|||||||
case "darwin":
|
case "darwin":
|
||||||
fallthrough
|
fallthrough
|
||||||
case "windows":
|
case "windows":
|
||||||
registry.GlobalFlags.EngineMode = entities.TunnelMode
|
registry.EngineOpts.EngineMode = entities.TunnelMode
|
||||||
case "linux":
|
case "linux":
|
||||||
registry.GlobalFlags.EngineMode = entities.ABIMode
|
registry.EngineOpts.EngineMode = entities.ABIMode
|
||||||
default:
|
default:
|
||||||
logrus.Errorf("%s is not a supported OS", runtime.GOOS)
|
logrus.Errorf("%s is not a supported OS", runtime.GOOS)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Is there a Cobra way to "peek" at os.Args?
|
// TODO: Is there a Cobra way to "peek" at os.Args?
|
||||||
if ok := Contains("--remote", os.Args); ok {
|
for _, v := range os.Args {
|
||||||
registry.GlobalFlags.EngineMode = entities.TunnelMode
|
if strings.HasPrefix(v, "--remote") {
|
||||||
|
registry.EngineOpts.EngineMode = entities.TunnelMode
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cobra.OnInitialize(func() {})
|
cobra.OnInitialize(func() {})
|
||||||
@ -50,7 +53,7 @@ func initCobra() {
|
|||||||
func main() {
|
func main() {
|
||||||
fmt.Fprintf(os.Stderr, "Number of commands: %d\n", len(registry.Commands))
|
fmt.Fprintf(os.Stderr, "Number of commands: %d\n", len(registry.Commands))
|
||||||
for _, c := range registry.Commands {
|
for _, c := range registry.Commands {
|
||||||
if Contains(registry.GlobalFlags.EngineMode, c.Mode) {
|
if Contains(registry.EngineOpts.EngineMode, c.Mode) {
|
||||||
parent := rootCmd
|
parent := rootCmd
|
||||||
if c.Parent != nil {
|
if c.Parent != nil {
|
||||||
parent = c.Parent
|
parent = c.Parent
|
||||||
|
@ -15,10 +15,12 @@ type CliCommand struct {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
Commands []CliCommand
|
Commands []CliCommand
|
||||||
GlobalFlags entities.EngineFlags
|
|
||||||
imageEngine entities.ImageEngine
|
imageEngine entities.ImageEngine
|
||||||
containerEngine entities.ContainerEngine
|
containerEngine entities.ContainerEngine
|
||||||
PodmanTunnel bool
|
|
||||||
|
EngineOpts entities.EngineOptions
|
||||||
|
GlobalFlags entities.EngineFlags
|
||||||
)
|
)
|
||||||
|
|
||||||
// HelpTemplate returns the help template for podman commands
|
// HelpTemplate returns the help template for podman commands
|
||||||
@ -63,7 +65,8 @@ func ImageEngine() entities.ImageEngine {
|
|||||||
// NewImageEngine is a wrapper for building an ImageEngine to be used for PreRunE functions
|
// NewImageEngine is a wrapper for building an ImageEngine to be used for PreRunE functions
|
||||||
func NewImageEngine(cmd *cobra.Command, args []string) (entities.ImageEngine, error) {
|
func NewImageEngine(cmd *cobra.Command, args []string) (entities.ImageEngine, error) {
|
||||||
if imageEngine == nil {
|
if imageEngine == nil {
|
||||||
engine, err := infra.NewImageEngine(GlobalFlags.EngineMode, entities.EngineOptions{})
|
EngineOpts.FlagSet = cmd.Flags()
|
||||||
|
engine, err := infra.NewImageEngine(EngineOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -79,7 +82,8 @@ func ContainerEngine() entities.ContainerEngine {
|
|||||||
// NewContainerEngine is a wrapper for building an ContainerEngine to be used for PreRunE functions
|
// NewContainerEngine is a wrapper for building an ContainerEngine to be used for PreRunE functions
|
||||||
func NewContainerEngine(cmd *cobra.Command, args []string) (entities.ContainerEngine, error) {
|
func NewContainerEngine(cmd *cobra.Command, args []string) (entities.ContainerEngine, error) {
|
||||||
if containerEngine == nil {
|
if containerEngine == nil {
|
||||||
engine, err := infra.NewContainerEngine(GlobalFlags.EngineMode, entities.EngineOptions{})
|
EngineOpts.FlagSet = cmd.Flags()
|
||||||
|
engine, err := infra.NewContainerEngine(EngineOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,8 @@ func init() {
|
|||||||
// Override default --help information of `--version` global flag}
|
// Override default --help information of `--version` global flag}
|
||||||
var dummyVersion bool
|
var dummyVersion bool
|
||||||
rootCmd.PersistentFlags().BoolVarP(&dummyVersion, "version", "v", false, "Version of podman")
|
rootCmd.PersistentFlags().BoolVarP(&dummyVersion, "version", "v", false, "Version of podman")
|
||||||
rootCmd.PersistentFlags().BoolVarP(®istry.PodmanTunnel, "remote", "r", false, "Access service via SSH tunnel")
|
rootCmd.PersistentFlags().StringVarP(®istry.EngineOpts.Uri, "remote", "r", "", "URL to access podman service")
|
||||||
|
rootCmd.PersistentFlags().StringSliceVar(®istry.EngineOpts.Identities, "identity", []string{}, "path to SSH identity file")
|
||||||
}
|
}
|
||||||
|
|
||||||
func Execute() {
|
func Execute() {
|
||||||
|
@ -21,8 +21,12 @@ func ContainerExists(w http.ResponseWriter, r *http.Request) {
|
|||||||
name := utils.GetName(r)
|
name := utils.GetName(r)
|
||||||
_, err := runtime.LookupContainer(name)
|
_, err := runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if errors.Cause(err) == define.ErrNoSuchCtr {
|
||||||
utils.ContainerNotFound(w, name, err)
|
utils.ContainerNotFound(w, name, err)
|
||||||
|
}
|
||||||
|
utils.InternalServerError(w, err)
|
||||||
return
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
utils.WriteResponse(w, http.StatusNoContent, "")
|
utils.WriteResponse(w, http.StatusNoContent, "")
|
||||||
}
|
}
|
||||||
|
@ -165,8 +165,13 @@ func sshClient(_url *url.URL, identity string, secure bool) (*http.Client, error
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
port := _url.Port()
|
||||||
|
if port == "" {
|
||||||
|
port = "22"
|
||||||
|
}
|
||||||
|
|
||||||
bastion, err := ssh.Dial("tcp",
|
bastion, err := ssh.Dial("tcp",
|
||||||
net.JoinHostPort(_url.Hostname(), _url.Port()),
|
net.JoinHostPort(_url.Hostname(), port),
|
||||||
&ssh.ClientConfig{
|
&ssh.ClientConfig{
|
||||||
User: _url.User.Username(),
|
User: _url.User.Username(),
|
||||||
Auth: []ssh.AuthMethod{auth},
|
Auth: []ssh.AuthMethod{auth},
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/containers/libpod/libpod"
|
"github.com/containers/libpod/libpod"
|
||||||
|
"github.com/containers/libpod/libpod/define"
|
||||||
lpapiv2 "github.com/containers/libpod/pkg/api/handlers/libpod"
|
lpapiv2 "github.com/containers/libpod/pkg/api/handlers/libpod"
|
||||||
"github.com/containers/libpod/pkg/bindings"
|
"github.com/containers/libpod/pkg/bindings"
|
||||||
)
|
)
|
||||||
@ -212,7 +213,7 @@ func Unpause(ctx context.Context, nameOrID string) error {
|
|||||||
// Wait blocks until the given container reaches a condition. If not provided, the condition will
|
// Wait blocks until the given container reaches a condition. If not provided, the condition will
|
||||||
// default to stopped. If the condition is stopped, an exit code for the container will be provided. The
|
// default to stopped. If the condition is stopped, an exit code for the container will be provided. The
|
||||||
// nameOrID can be a container name or a partial/full ID.
|
// nameOrID can be a container name or a partial/full ID.
|
||||||
func Wait(ctx context.Context, nameOrID string, condition *string) (int32, error) {
|
func Wait(ctx context.Context, nameOrID string, condition *define.ContainerStatus) (int32, error) { //nolint
|
||||||
var exitCode int32
|
var exitCode int32
|
||||||
conn, err := bindings.GetClient(ctx)
|
conn, err := bindings.GetClient(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -220,7 +221,7 @@ func Wait(ctx context.Context, nameOrID string, condition *string) (int32, error
|
|||||||
}
|
}
|
||||||
params := url.Values{}
|
params := url.Values{}
|
||||||
if condition != nil {
|
if condition != nil {
|
||||||
params.Set("condition", *condition)
|
params.Set("condition", condition.String())
|
||||||
}
|
}
|
||||||
response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/wait", params, nameOrID)
|
response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/wait", params, nameOrID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -3,6 +3,7 @@ package test_bindings
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/containers/libpod/libpod/define"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -205,8 +206,8 @@ func (b *bindingTest) RunTopContainer(containerName *string, insidePod *bool, po
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
waiting := "running"
|
wait := define.ContainerStateRunning
|
||||||
_, err = containers.Wait(b.conn, ctr.ID, &waiting)
|
_, err = containers.Wait(b.conn, ctr.ID, &wait)
|
||||||
return ctr.ID, err
|
return ctr.ID, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package test_bindings
|
package test_bindings
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/containers/libpod/libpod/define"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -282,8 +283,8 @@ var _ = Describe("Podman containers ", func() {
|
|||||||
var (
|
var (
|
||||||
name = "top"
|
name = "top"
|
||||||
exitCode int32 = -1
|
exitCode int32 = -1
|
||||||
pause = "paused"
|
pause = define.ContainerStatePaused
|
||||||
unpause = "running"
|
running = define.ContainerStateRunning
|
||||||
)
|
)
|
||||||
errChan := make(chan error)
|
errChan := make(chan error)
|
||||||
_, err := bt.RunTopContainer(&name, nil, nil)
|
_, err := bt.RunTopContainer(&name, nil, nil)
|
||||||
@ -301,7 +302,7 @@ var _ = Describe("Podman containers ", func() {
|
|||||||
|
|
||||||
errChan = make(chan error)
|
errChan = make(chan error)
|
||||||
go func() {
|
go func() {
|
||||||
_, waitErr := containers.Wait(bt.conn, name, &unpause)
|
_, waitErr := containers.Wait(bt.conn, name, &running)
|
||||||
errChan <- waitErr
|
errChan <- waitErr
|
||||||
close(errChan)
|
close(errChan)
|
||||||
}()
|
}()
|
||||||
|
@ -1 +1,23 @@
|
|||||||
package entities
|
package entities
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/containers/libpod/libpod/define"
|
||||||
|
)
|
||||||
|
|
||||||
|
type WaitOptions struct {
|
||||||
|
Condition define.ContainerStatus
|
||||||
|
Interval time.Duration
|
||||||
|
Latest bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type WaitReport struct {
|
||||||
|
Id string
|
||||||
|
Error error
|
||||||
|
ExitCode int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type BoolReport struct {
|
||||||
|
Value bool
|
||||||
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package entities
|
package entities
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/url"
|
|
||||||
"os/user"
|
"os/user"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
@ -20,11 +19,13 @@ func (m EngineMode) String() string {
|
|||||||
return string(m)
|
return string(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: merge EngineOptions and EngineFlags
|
||||||
type EngineOptions struct {
|
type EngineOptions struct {
|
||||||
Uri *url.URL
|
Uri string
|
||||||
Identities []string
|
Identities []string
|
||||||
FlagSet pflag.FlagSet
|
FlagSet *pflag.FlagSet
|
||||||
Flags EngineFlags
|
Flags EngineFlags
|
||||||
|
EngineMode EngineMode
|
||||||
}
|
}
|
||||||
|
|
||||||
type EngineFlags struct {
|
type EngineFlags struct {
|
||||||
@ -58,8 +59,6 @@ type EngineFlags struct {
|
|||||||
Port int
|
Port int
|
||||||
IdentityFile string
|
IdentityFile string
|
||||||
IgnoreHosts bool
|
IgnoreHosts bool
|
||||||
|
|
||||||
EngineMode EngineMode
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEngineOptions() (EngineFlags, error) {
|
func NewEngineOptions() (EngineFlags, error) {
|
||||||
|
@ -5,22 +5,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ContainerEngine interface {
|
type ContainerEngine interface {
|
||||||
ContainerRuntime
|
|
||||||
PodRuntime
|
|
||||||
VolumeRuntime
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerRuntime interface {
|
|
||||||
ContainerDelete(ctx context.Context, opts ContainerDeleteOptions) (*ContainerDeleteReport, error)
|
ContainerDelete(ctx context.Context, opts ContainerDeleteOptions) (*ContainerDeleteReport, error)
|
||||||
ContainerPrune(ctx context.Context) (*ContainerPruneReport, error)
|
ContainerPrune(ctx context.Context) (*ContainerPruneReport, error)
|
||||||
}
|
ContainerExists(ctx context.Context, nameOrId string) (*BoolReport, error)
|
||||||
|
ContainerWait(ctx context.Context, namesOrIds []string, options WaitOptions) ([]WaitReport, error)
|
||||||
type PodRuntime interface {
|
|
||||||
PodDelete(ctx context.Context, opts PodPruneOptions) (*PodDeleteReport, error)
|
PodDelete(ctx context.Context, opts PodPruneOptions) (*PodDeleteReport, error)
|
||||||
PodPrune(ctx context.Context) (*PodPruneReport, error)
|
PodPrune(ctx context.Context) (*PodPruneReport, error)
|
||||||
}
|
|
||||||
|
|
||||||
type VolumeRuntime interface {
|
|
||||||
VolumeDelete(ctx context.Context, opts VolumeDeleteOptions) (*VolumeDeleteReport, error)
|
VolumeDelete(ctx context.Context, opts VolumeDeleteOptions) (*VolumeDeleteReport, error)
|
||||||
VolumePrune(ctx context.Context) (*VolumePruneReport, error)
|
VolumePrune(ctx context.Context) (*VolumePruneReport, error)
|
||||||
}
|
}
|
||||||
|
66
pkg/domain/infra/abi/containers.go
Normal file
66
pkg/domain/infra/abi/containers.go
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
// +build ABISupport
|
||||||
|
|
||||||
|
package abi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/containers/libpod/libpod/define"
|
||||||
|
"github.com/containers/libpod/pkg/adapter/shortcuts"
|
||||||
|
"github.com/containers/libpod/pkg/domain/entities"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TODO: Should return *entities.ContainerExistsReport, error
|
||||||
|
func (ic *ContainerEngine) ContainerExists(ctx context.Context, nameOrId string) (*entities.BoolReport, error) {
|
||||||
|
_, err := ic.Libpod.LookupContainer(nameOrId)
|
||||||
|
if err != nil && errors.Cause(err) != define.ErrNoSuchCtr {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &entities.BoolReport{Value: err == nil}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ic *ContainerEngine) ContainerWait(ctx context.Context, namesOrIds []string, options entities.WaitOptions) ([]entities.WaitReport, error) {
|
||||||
|
var (
|
||||||
|
responses []entities.WaitReport
|
||||||
|
)
|
||||||
|
ctrs, err := shortcuts.GetContainersByContext(false, options.Latest, namesOrIds, ic.Libpod)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for _, c := range ctrs {
|
||||||
|
response := entities.WaitReport{Id: c.ID()}
|
||||||
|
exitCode, err := c.WaitForConditionWithInterval(options.Interval, options.Condition)
|
||||||
|
if err != nil {
|
||||||
|
response.Error = err
|
||||||
|
} else {
|
||||||
|
response.ExitCode = exitCode
|
||||||
|
}
|
||||||
|
responses = append(responses, response)
|
||||||
|
}
|
||||||
|
return responses, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ic *ContainerEngine) ContainerDelete(ctx context.Context, opts entities.ContainerDeleteOptions) (*entities.ContainerDeleteReport, error) {
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ic *ContainerEngine) ContainerPrune(ctx context.Context) (*entities.ContainerPruneReport, error) {
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ic *ContainerEngine) PodDelete(ctx context.Context, opts entities.PodPruneOptions) (*entities.PodDeleteReport, error) {
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ic *ContainerEngine) PodPrune(ctx context.Context) (*entities.PodPruneReport, error) {
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ic *ContainerEngine) VolumeDelete(ctx context.Context, opts entities.VolumeDeleteOptions) (*entities.VolumeDeleteReport, error) {
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ic *ContainerEngine) VolumePrune(ctx context.Context) (*entities.VolumePruneReport, error) {
|
||||||
|
panic("implement me")
|
||||||
|
}
|
@ -4,7 +4,6 @@ package abi
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/containers/libpod/libpod"
|
"github.com/containers/libpod/libpod"
|
||||||
"github.com/containers/libpod/pkg/domain/entities"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Image-related runtime linked against libpod library
|
// Image-related runtime linked against libpod library
|
||||||
@ -14,6 +13,5 @@ type ImageEngine struct {
|
|||||||
|
|
||||||
// Container-related runtime linked against libpod library
|
// Container-related runtime linked against libpod library
|
||||||
type ContainerEngine struct {
|
type ContainerEngine struct {
|
||||||
entities.ContainerEngine
|
|
||||||
Libpod *libpod.Runtime
|
Libpod *libpod.Runtime
|
||||||
}
|
}
|
||||||
|
@ -8,32 +8,31 @@ import (
|
|||||||
|
|
||||||
"github.com/containers/libpod/pkg/bindings"
|
"github.com/containers/libpod/pkg/bindings"
|
||||||
"github.com/containers/libpod/pkg/domain/entities"
|
"github.com/containers/libpod/pkg/domain/entities"
|
||||||
"github.com/containers/libpod/pkg/domain/infra/abi"
|
|
||||||
"github.com/containers/libpod/pkg/domain/infra/tunnel"
|
"github.com/containers/libpod/pkg/domain/infra/tunnel"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewContainerEngine factory provides a libpod runtime for container-related operations
|
// NewContainerEngine factory provides a libpod runtime for container-related operations
|
||||||
func NewContainerEngine(mode entities.EngineMode, opts entities.EngineOptions) (entities.ContainerEngine, error) {
|
func NewContainerEngine(opts entities.EngineOptions) (entities.ContainerEngine, error) {
|
||||||
switch mode {
|
switch opts.EngineMode {
|
||||||
case entities.ABIMode:
|
case entities.ABIMode:
|
||||||
r, err := NewLibpodRuntime(opts.FlagSet, opts.Flags)
|
r, err := NewLibpodRuntime(opts.FlagSet, opts.Flags)
|
||||||
return &abi.ContainerEngine{ContainerEngine: r}, err
|
return r, err
|
||||||
case entities.TunnelMode:
|
case entities.TunnelMode:
|
||||||
ctx, err := bindings.NewConnection(context.Background(), opts.Uri.String(), opts.Identities...)
|
ctx, err := bindings.NewConnection(context.Background(), opts.Uri, opts.Identities...)
|
||||||
return &tunnel.ContainerEngine{ClientCxt: ctx}, err
|
return &tunnel.ContainerEngine{ClientCxt: ctx}, err
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("runtime mode '%v' is not supported", mode)
|
return nil, fmt.Errorf("runtime mode '%v' is not supported", opts.EngineMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewContainerEngine factory provides a libpod runtime for image-related operations
|
// NewContainerEngine factory provides a libpod runtime for image-related operations
|
||||||
func NewImageEngine(mode entities.EngineMode, opts entities.EngineOptions) (entities.ImageEngine, error) {
|
func NewImageEngine(opts entities.EngineOptions) (entities.ImageEngine, error) {
|
||||||
switch mode {
|
switch opts.EngineMode {
|
||||||
case entities.ABIMode:
|
case entities.ABIMode:
|
||||||
r, err := NewLibpodImageRuntime(opts.FlagSet, opts.Flags)
|
r, err := NewLibpodImageRuntime(opts.FlagSet, opts.Flags)
|
||||||
return r, err
|
return r, err
|
||||||
case entities.TunnelMode:
|
case entities.TunnelMode:
|
||||||
ctx, err := bindings.NewConnection(context.Background(), opts.Uri.String(), opts.Identities...)
|
ctx, err := bindings.NewConnection(context.Background(), opts.Uri, opts.Identities...)
|
||||||
return &tunnel.ImageEngine{ClientCxt: ctx}, err
|
return &tunnel.ImageEngine{ClientCxt: ctx}, err
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("runtime mode '%v' is not supported", mode)
|
return nil, fmt.Errorf("runtime mode '%v' is not supported", opts.EngineMode)
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,10 @@ import (
|
|||||||
|
|
||||||
// ContainerEngine Image Proxy will be EOL'ed after podmanV2 is separated from libpod repo
|
// ContainerEngine Image Proxy will be EOL'ed after podmanV2 is separated from libpod repo
|
||||||
|
|
||||||
func NewLibpodImageRuntime(flags pflag.FlagSet, opts entities.EngineFlags) (entities.ImageEngine, error) {
|
func NewLibpodImageRuntime(flags *pflag.FlagSet, opts entities.EngineFlags) (entities.ImageEngine, error) {
|
||||||
r, err := GetRuntime(context.Background(), flags, opts)
|
r, err := GetRuntime(context.Background(), flags, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &abi.ImageEngine{Libpod: r}, nil
|
return &abi.ImageEngine{Libpod: r}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ir *runtime) ShutdownImageRuntime(force bool) error {
|
|
||||||
return ir.Libpod.Shutdown(force)
|
|
||||||
}
|
|
||||||
|
@ -26,7 +26,7 @@ type engineOpts struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetRuntimeMigrate gets a libpod runtime that will perform a migration of existing containers
|
// GetRuntimeMigrate gets a libpod runtime that will perform a migration of existing containers
|
||||||
func GetRuntimeMigrate(ctx context.Context, fs flag.FlagSet, ef entities.EngineFlags, newRuntime string) (*libpod.Runtime, error) {
|
func GetRuntimeMigrate(ctx context.Context, fs *flag.FlagSet, ef entities.EngineFlags, newRuntime string) (*libpod.Runtime, error) {
|
||||||
return getRuntime(ctx, fs, &engineOpts{
|
return getRuntime(ctx, fs, &engineOpts{
|
||||||
name: newRuntime,
|
name: newRuntime,
|
||||||
renumber: false,
|
renumber: false,
|
||||||
@ -38,7 +38,7 @@ func GetRuntimeMigrate(ctx context.Context, fs flag.FlagSet, ef entities.EngineF
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetRuntimeDisableFDs gets a libpod runtime that will disable sd notify
|
// GetRuntimeDisableFDs gets a libpod runtime that will disable sd notify
|
||||||
func GetRuntimeDisableFDs(ctx context.Context, fs flag.FlagSet, ef entities.EngineFlags) (*libpod.Runtime, error) {
|
func GetRuntimeDisableFDs(ctx context.Context, fs *flag.FlagSet, ef entities.EngineFlags) (*libpod.Runtime, error) {
|
||||||
return getRuntime(ctx, fs, &engineOpts{
|
return getRuntime(ctx, fs, &engineOpts{
|
||||||
renumber: false,
|
renumber: false,
|
||||||
migrate: false,
|
migrate: false,
|
||||||
@ -49,7 +49,7 @@ func GetRuntimeDisableFDs(ctx context.Context, fs flag.FlagSet, ef entities.Engi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetRuntimeRenumber gets a libpod runtime that will perform a lock renumber
|
// GetRuntimeRenumber gets a libpod runtime that will perform a lock renumber
|
||||||
func GetRuntimeRenumber(ctx context.Context, fs flag.FlagSet, ef entities.EngineFlags) (*libpod.Runtime, error) {
|
func GetRuntimeRenumber(ctx context.Context, fs *flag.FlagSet, ef entities.EngineFlags) (*libpod.Runtime, error) {
|
||||||
return getRuntime(ctx, fs, &engineOpts{
|
return getRuntime(ctx, fs, &engineOpts{
|
||||||
renumber: true,
|
renumber: true,
|
||||||
migrate: false,
|
migrate: false,
|
||||||
@ -60,7 +60,7 @@ func GetRuntimeRenumber(ctx context.Context, fs flag.FlagSet, ef entities.Engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetRuntime generates a new libpod runtime configured by command line options
|
// GetRuntime generates a new libpod runtime configured by command line options
|
||||||
func GetRuntime(ctx context.Context, flags flag.FlagSet, ef entities.EngineFlags) (*libpod.Runtime, error) {
|
func GetRuntime(ctx context.Context, flags *flag.FlagSet, ef entities.EngineFlags) (*libpod.Runtime, error) {
|
||||||
return getRuntime(ctx, flags, &engineOpts{
|
return getRuntime(ctx, flags, &engineOpts{
|
||||||
renumber: false,
|
renumber: false,
|
||||||
migrate: false,
|
migrate: false,
|
||||||
@ -71,7 +71,7 @@ func GetRuntime(ctx context.Context, flags flag.FlagSet, ef entities.EngineFlags
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetRuntimeNoStore generates a new libpod runtime configured by command line options
|
// GetRuntimeNoStore generates a new libpod runtime configured by command line options
|
||||||
func GetRuntimeNoStore(ctx context.Context, fs flag.FlagSet, ef entities.EngineFlags) (*libpod.Runtime, error) {
|
func GetRuntimeNoStore(ctx context.Context, fs *flag.FlagSet, ef entities.EngineFlags) (*libpod.Runtime, error) {
|
||||||
return getRuntime(ctx, fs, &engineOpts{
|
return getRuntime(ctx, fs, &engineOpts{
|
||||||
renumber: false,
|
renumber: false,
|
||||||
migrate: false,
|
migrate: false,
|
||||||
@ -81,7 +81,7 @@ func GetRuntimeNoStore(ctx context.Context, fs flag.FlagSet, ef entities.EngineF
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func getRuntime(ctx context.Context, fs flag.FlagSet, opts *engineOpts) (*libpod.Runtime, error) {
|
func getRuntime(ctx context.Context, fs *flag.FlagSet, opts *engineOpts) (*libpod.Runtime, error) {
|
||||||
options := []libpod.RuntimeOption{}
|
options := []libpod.RuntimeOption{}
|
||||||
storageOpts := storage.StoreOptions{}
|
storageOpts := storage.StoreOptions{}
|
||||||
storageSet := false
|
storageSet := false
|
||||||
|
@ -5,50 +5,17 @@ package infra
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/containers/libpod/libpod"
|
|
||||||
"github.com/containers/libpod/pkg/domain/entities"
|
"github.com/containers/libpod/pkg/domain/entities"
|
||||||
|
"github.com/containers/libpod/pkg/domain/infra/abi"
|
||||||
flag "github.com/spf13/pflag"
|
flag "github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerEngine Proxy will be EOL'ed after podmanV2 is separated from libpod repo
|
// ContainerEngine Proxy will be EOL'ed after podmanV2 is separated from libpod repo
|
||||||
|
|
||||||
type runtime struct {
|
func NewLibpodRuntime(flags *flag.FlagSet, opts entities.EngineFlags) (entities.ContainerEngine, error) {
|
||||||
entities.ContainerEngine
|
|
||||||
Libpod *libpod.Runtime
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewLibpodRuntime(flags flag.FlagSet, opts entities.EngineFlags) (entities.ContainerEngine, error) {
|
|
||||||
r, err := GetRuntime(context.Background(), flags, opts)
|
r, err := GetRuntime(context.Background(), flags, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &runtime{Libpod: r}, nil
|
return &abi.ContainerEngine{Libpod: r}, nil
|
||||||
}
|
|
||||||
|
|
||||||
func (r *runtime) ShutdownRuntime(force bool) error {
|
|
||||||
return r.Libpod.Shutdown(force)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *runtime) ContainerDelete(ctx context.Context, opts entities.ContainerDeleteOptions) (*entities.ContainerDeleteReport, error) {
|
|
||||||
panic("implement me")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *runtime) ContainerPrune(ctx context.Context) (*entities.ContainerPruneReport, error) {
|
|
||||||
panic("implement me")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *runtime) PodDelete(ctx context.Context, opts entities.PodPruneOptions) (*entities.PodDeleteReport, error) {
|
|
||||||
panic("implement me")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *runtime) PodPrune(ctx context.Context) (*entities.PodPruneReport, error) {
|
|
||||||
panic("implement me")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *runtime) VolumeDelete(ctx context.Context, opts entities.VolumeDeleteOptions) (*entities.VolumeDeleteReport, error) {
|
|
||||||
panic("implement me")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *runtime) VolumePrune(ctx context.Context) (*entities.VolumePruneReport, error) {
|
|
||||||
panic("implement me")
|
|
||||||
}
|
}
|
||||||
|
@ -11,25 +11,25 @@ import (
|
|||||||
"github.com/containers/libpod/pkg/domain/infra/tunnel"
|
"github.com/containers/libpod/pkg/domain/infra/tunnel"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewContainerEngine(mode entities.EngineMode, opts entities.EngineOptions) (entities.ContainerEngine, error) {
|
func NewContainerEngine(opts entities.EngineOptions) (entities.ContainerEngine, error) {
|
||||||
switch mode {
|
switch opts.EngineMode {
|
||||||
case entities.ABIMode:
|
case entities.ABIMode:
|
||||||
return nil, fmt.Errorf("direct runtime not supported")
|
return nil, fmt.Errorf("direct runtime not supported")
|
||||||
case entities.TunnelMode:
|
case entities.TunnelMode:
|
||||||
ctx, err := bindings.NewConnection(context.Background(), opts.Uri.String(), opts.Identities...)
|
ctx, err := bindings.NewConnection(context.Background(), opts.Uri, opts.Identities...)
|
||||||
return &tunnel.ContainerEngine{ClientCxt: ctx}, err
|
return &tunnel.ContainerEngine{ClientCxt: ctx}, err
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("runtime mode '%v' is not supported", mode)
|
return nil, fmt.Errorf("runtime mode '%v' is not supported", opts.EngineMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageEngine factory provides a libpod runtime for image-related operations
|
// NewImageEngine factory provides a libpod runtime for image-related operations
|
||||||
func NewImageEngine(mode entities.EngineMode, opts entities.EngineOptions) (entities.ImageEngine, error) {
|
func NewImageEngine(opts entities.EngineOptions) (entities.ImageEngine, error) {
|
||||||
switch mode {
|
switch opts.EngineMode {
|
||||||
case entities.ABIMode:
|
case entities.ABIMode:
|
||||||
return nil, fmt.Errorf("direct image runtime not supported")
|
return nil, fmt.Errorf("direct image runtime not supported")
|
||||||
case entities.TunnelMode:
|
case entities.TunnelMode:
|
||||||
ctx, err := bindings.NewConnection(context.Background(), opts.Uri.String(), opts.Identities...)
|
ctx, err := bindings.NewConnection(context.Background(), opts.Uri, opts.Identities...)
|
||||||
return &tunnel.ImageEngine{ClientCxt: ctx}, err
|
return &tunnel.ImageEngine{ClientCxt: ctx}, err
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("runtime mode '%v' is not supported", mode)
|
return nil, fmt.Errorf("runtime mode '%v' is not supported", opts.EngineMode)
|
||||||
}
|
}
|
||||||
|
42
pkg/domain/infra/tunnel/containers.go
Normal file
42
pkg/domain/infra/tunnel/containers.go
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package tunnel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/containers/libpod/pkg/bindings/containers"
|
||||||
|
"github.com/containers/libpod/pkg/domain/entities"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (ic *ContainerEngine) ContainerExists(ctx context.Context, nameOrId string) (*entities.BoolReport, error) {
|
||||||
|
exists, err := containers.Exists(ic.ClientCxt, nameOrId)
|
||||||
|
return &entities.BoolReport{Value: exists}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ic *ContainerEngine) ContainerWait(ctx context.Context, namesOrIds []string, options entities.WaitOptions) ([]entities.WaitReport, error) {
|
||||||
|
var (
|
||||||
|
responses []entities.WaitReport
|
||||||
|
)
|
||||||
|
cons, err := getContainersByContext(ic.ClientCxt, false, namesOrIds)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for _, c := range cons {
|
||||||
|
response := entities.WaitReport{Id: c.ID}
|
||||||
|
exitCode, err := containers.Wait(ic.ClientCxt, c.ID, &options.Condition)
|
||||||
|
if err != nil {
|
||||||
|
response.Error = err
|
||||||
|
} else {
|
||||||
|
response.ExitCode = exitCode
|
||||||
|
}
|
||||||
|
responses = append(responses, response)
|
||||||
|
}
|
||||||
|
return responses, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *ContainerEngine) ContainerDelete(ctx context.Context, opts entities.ContainerDeleteOptions) (*entities.ContainerDeleteReport, error) {
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *ContainerEngine) ContainerPrune(ctx context.Context) (*entities.ContainerPruneReport, error) {
|
||||||
|
panic("implement me")
|
||||||
|
}
|
41
pkg/domain/infra/tunnel/helpers.go
Normal file
41
pkg/domain/infra/tunnel/helpers.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package tunnel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/containers/libpod/pkg/api/handlers/libpod"
|
||||||
|
"github.com/containers/libpod/pkg/bindings"
|
||||||
|
"github.com/containers/libpod/pkg/bindings/containers"
|
||||||
|
"github.com/containers/libpod/pkg/util"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getContainersByContext(contextWithConnection context.Context, all bool, namesOrIds []string) ([]libpod.ListContainer, error) {
|
||||||
|
var (
|
||||||
|
cons []libpod.ListContainer
|
||||||
|
)
|
||||||
|
if all && len(namesOrIds) > 0 {
|
||||||
|
return nil, errors.New("cannot lookup containers and all")
|
||||||
|
}
|
||||||
|
c, err := containers.List(contextWithConnection, nil, &bindings.PTrue, nil, nil, nil, &bindings.PTrue)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if all {
|
||||||
|
return c, err
|
||||||
|
}
|
||||||
|
for _, id := range namesOrIds {
|
||||||
|
var found bool
|
||||||
|
for _, con := range c {
|
||||||
|
if id == con.ID || util.StringInSlice(id, con.Names) {
|
||||||
|
cons = append(cons, con)
|
||||||
|
found = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
return nil, errors.Errorf("unable to find container %q", id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cons, nil
|
||||||
|
}
|
@ -16,18 +16,6 @@ type ContainerEngine struct {
|
|||||||
ClientCxt context.Context
|
ClientCxt context.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *ContainerEngine) Shutdown(force bool) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *ContainerEngine) ContainerDelete(ctx context.Context, opts entities.ContainerDeleteOptions) (*entities.ContainerDeleteReport, error) {
|
|
||||||
panic("implement me")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *ContainerEngine) ContainerPrune(ctx context.Context) (*entities.ContainerPruneReport, error) {
|
|
||||||
panic("implement me")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *ContainerEngine) PodDelete(ctx context.Context, opts entities.PodPruneOptions) (*entities.PodDeleteReport, error) {
|
func (r *ContainerEngine) PodDelete(ctx context.Context, opts entities.PodPruneOptions) (*entities.PodDeleteReport, error) {
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user