summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-03-24 21:48:37 +0100
committerGitHub <noreply@github.com>2020-03-24 21:48:37 +0100
commit0c084d9719772a9b68d5eb67114cf5bf001958b2 (patch)
treef6ed82f9c435c30b44d5c820502607ba60e89282
parentc29a4c69044c02eee564fc72c64144b2a76d1d73 (diff)
parent77a2af8817284d134ea1f30f0b06291a5b05c5a0 (diff)
downloadpodman-0c084d9719772a9b68d5eb67114cf5bf001958b2.tar.gz
podman-0c084d9719772a9b68d5eb67114cf5bf001958b2.tar.bz2
podman-0c084d9719772a9b68d5eb67114cf5bf001958b2.zip
Merge pull request #5592 from jwhonce/wip/globalflags
Combine GlobalFlags and EngineFlags into EngineOptions
-rw-r--r--cmd/podmanV2/containers/kill.go2
-rw-r--r--cmd/podmanV2/containers/pause.go2
-rw-r--r--cmd/podmanV2/containers/restart.go2
-rw-r--r--cmd/podmanV2/containers/rm.go2
-rw-r--r--cmd/podmanV2/containers/stop.go2
-rw-r--r--cmd/podmanV2/containers/unpause.go2
-rw-r--r--cmd/podmanV2/containers/wait.go2
-rw-r--r--cmd/podmanV2/images/inspect.go2
-rw-r--r--cmd/podmanV2/images/list.go1
-rw-r--r--cmd/podmanV2/main.go8
-rw-r--r--cmd/podmanV2/registry/registry.go28
-rw-r--r--cmd/podmanV2/registry/remote.go9
-rw-r--r--cmd/podmanV2/root.go7
-rw-r--r--cmd/podmanV2/utils/remote.go10
-rw-r--r--pkg/domain/entities/engine.go8
-rw-r--r--pkg/domain/infra/runtime_abi.go20
-rw-r--r--pkg/domain/infra/runtime_image_proxy.go2
-rw-r--r--pkg/domain/infra/runtime_libpod.go12
-rw-r--r--pkg/domain/infra/runtime_proxy.go2
-rw-r--r--pkg/domain/infra/runtime_tunnel.go16
20 files changed, 76 insertions, 63 deletions
diff --git a/cmd/podmanV2/containers/kill.go b/cmd/podmanV2/containers/kill.go
index b02dcf9da..36c4f2528 100644
--- a/cmd/podmanV2/containers/kill.go
+++ b/cmd/podmanV2/containers/kill.go
@@ -41,7 +41,7 @@ func init() {
flags.BoolVarP(&killOptions.All, "all", "a", false, "Signal all running containers")
flags.StringVarP(&killOptions.Signal, "signal", "s", "KILL", "Signal to send to the container")
flags.BoolVarP(&killOptions.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
- if utils.IsRemote() {
+ if registry.IsRemote() {
_ = flags.MarkHidden("latest")
}
}
diff --git a/cmd/podmanV2/containers/pause.go b/cmd/podmanV2/containers/pause.go
index 3f3e7c38d..99ca34d5c 100644
--- a/cmd/podmanV2/containers/pause.go
+++ b/cmd/podmanV2/containers/pause.go
@@ -42,7 +42,7 @@ func pause(cmd *cobra.Command, args []string) error {
var (
errs utils.OutputErrors
)
- if rootless.IsRootless() && !utils.IsRemote() {
+ if rootless.IsRootless() && !registry.IsRemote() {
return errors.New("pause is not supported for rootless containers")
}
if len(args) < 1 && !pauseOpts.All {
diff --git a/cmd/podmanV2/containers/restart.go b/cmd/podmanV2/containers/restart.go
index ee9c34361..216824389 100644
--- a/cmd/podmanV2/containers/restart.go
+++ b/cmd/podmanV2/containers/restart.go
@@ -47,7 +47,7 @@ func init() {
flags.BoolVar(&restartOptions.Running, "running", false, "Restart only running containers when --all is used")
flags.UintVarP(&restartTimeout, "timeout", "t", define.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
flags.UintVar(&restartTimeout, "time", define.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
- if utils.IsRemote() {
+ if registry.IsRemote() {
_ = flags.MarkHidden("latest")
}
}
diff --git a/cmd/podmanV2/containers/rm.go b/cmd/podmanV2/containers/rm.go
index af7a38fb1..916dd2577 100644
--- a/cmd/podmanV2/containers/rm.go
+++ b/cmd/podmanV2/containers/rm.go
@@ -50,7 +50,7 @@ func init() {
flags.BoolVar(&rmOptions.Storage, "storage", false, "Remove container from storage library")
flags.BoolVarP(&rmOptions.Volumes, "volumes", "v", false, "Remove anonymous volumes associated with the container")
flags.StringArrayVarP(&rmOptions.CIDFiles, "cidfile", "", nil, "Read the container ID from the file")
- if utils.IsRemote() {
+ if registry.IsRemote() {
_ = flags.MarkHidden("latest")
_ = flags.MarkHidden("ignore")
_ = flags.MarkHidden("cidfile")
diff --git a/cmd/podmanV2/containers/stop.go b/cmd/podmanV2/containers/stop.go
index 066202298..b6d70784d 100644
--- a/cmd/podmanV2/containers/stop.go
+++ b/cmd/podmanV2/containers/stop.go
@@ -48,7 +48,7 @@ func init() {
flags.BoolVarP(&stopOptions.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
flags.UintVar(&stopTimeout, "time", define.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
flags.UintVarP(&stopTimeout, "timeout", "t", define.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
- if registry.EngineOpts.EngineMode == entities.ABIMode {
+ if registry.EngineOptions.EngineMode == entities.ABIMode {
_ = flags.MarkHidden("latest")
_ = flags.MarkHidden("cidfile")
_ = flags.MarkHidden("ignore")
diff --git a/cmd/podmanV2/containers/unpause.go b/cmd/podmanV2/containers/unpause.go
index 697132a53..8b8cde9b2 100644
--- a/cmd/podmanV2/containers/unpause.go
+++ b/cmd/podmanV2/containers/unpause.go
@@ -39,7 +39,7 @@ func unpause(cmd *cobra.Command, args []string) error {
var (
errs utils.OutputErrors
)
- if rootless.IsRootless() && !utils.IsRemote() {
+ if rootless.IsRootless() && !registry.IsRemote() {
return errors.New("unpause is not supported for rootless containers")
}
if len(args) < 1 && !unPauseOptions.All {
diff --git a/cmd/podmanV2/containers/wait.go b/cmd/podmanV2/containers/wait.go
index cded8e571..4367fd9d9 100644
--- a/cmd/podmanV2/containers/wait.go
+++ b/cmd/podmanV2/containers/wait.go
@@ -46,7 +46,7 @@ func init() {
flags.DurationVarP(&waitOptions.Interval, "interval", "i", time.Duration(250), "Milliseconds to wait before polling for completion")
flags.BoolVarP(&waitOptions.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 {
+ if registry.EngineOptions.EngineMode == entities.ABIMode {
// TODO: This is the same as V1. We could skip creating the flag altogether in V2...
_ = flags.MarkHidden("latest")
}
diff --git a/cmd/podmanV2/images/inspect.go b/cmd/podmanV2/images/inspect.go
index 2ecbbb201..f8fd44571 100644
--- a/cmd/podmanV2/images/inspect.go
+++ b/cmd/podmanV2/images/inspect.go
@@ -52,7 +52,7 @@ func init() {
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")
- if registry.EngineOpts.EngineMode == entities.ABIMode {
+ if registry.EngineOptions.EngineMode == entities.ABIMode {
// TODO: This is the same as V1. We could skip creating the flag altogether in V2...
_ = flags.MarkHidden("latest")
}
diff --git a/cmd/podmanV2/images/list.go b/cmd/podmanV2/images/list.go
index cfdfaaed2..0441f8fd8 100644
--- a/cmd/podmanV2/images/list.go
+++ b/cmd/podmanV2/images/list.go
@@ -29,5 +29,6 @@ func init() {
}
func images(cmd *cobra.Command, args []string) error {
+ _, _ = registry.Options(cmd)
return nil
}
diff --git a/cmd/podmanV2/main.go b/cmd/podmanV2/main.go
index 24f21d804..dc96c26d0 100644
--- a/cmd/podmanV2/main.go
+++ b/cmd/podmanV2/main.go
@@ -32,9 +32,9 @@ func initCobra() {
case "darwin":
fallthrough
case "windows":
- registry.EngineOpts.EngineMode = entities.TunnelMode
+ registry.EngineOptions.EngineMode = entities.TunnelMode
case "linux":
- registry.EngineOpts.EngineMode = entities.ABIMode
+ registry.EngineOptions.EngineMode = entities.ABIMode
default:
logrus.Errorf("%s is not a supported OS", runtime.GOOS)
os.Exit(1)
@@ -43,7 +43,7 @@ func initCobra() {
// TODO: Is there a Cobra way to "peek" at os.Args?
for _, v := range os.Args {
if strings.HasPrefix(v, "--remote") {
- registry.EngineOpts.EngineMode = entities.TunnelMode
+ registry.EngineOptions.EngineMode = entities.TunnelMode
}
}
@@ -53,7 +53,7 @@ func initCobra() {
func main() {
fmt.Fprintf(os.Stderr, "Number of commands: %d\n", len(registry.Commands))
for _, c := range registry.Commands {
- if Contains(registry.EngineOpts.EngineMode, c.Mode) {
+ if Contains(registry.EngineOptions.EngineMode, c.Mode) {
parent := rootCmd
if c.Parent != nil {
parent = c.Parent
diff --git a/cmd/podmanV2/registry/registry.go b/cmd/podmanV2/registry/registry.go
index b0c11ba04..9c12b2456 100644
--- a/cmd/podmanV2/registry/registry.go
+++ b/cmd/podmanV2/registry/registry.go
@@ -1,6 +1,8 @@
package registry
import (
+ "context"
+
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/domain/entities"
"github.com/containers/libpod/pkg/domain/infra"
@@ -20,8 +22,7 @@ var (
imageEngine entities.ImageEngine
containerEngine entities.ContainerEngine
- EngineOpts entities.EngineOptions
- GlobalFlags entities.EngineFlags
+ EngineOptions entities.EngineOptions
ExitCode = define.ExecErrorCodeGeneric
)
@@ -76,8 +77,8 @@ func ImageEngine() entities.ImageEngine {
// NewImageEngine is a wrapper for building an ImageEngine to be used for PreRunE functions
func NewImageEngine(cmd *cobra.Command, args []string) (entities.ImageEngine, error) {
if imageEngine == nil {
- EngineOpts.FlagSet = cmd.Flags()
- engine, err := infra.NewImageEngine(EngineOpts)
+ EngineOptions.FlagSet = cmd.Flags()
+ engine, err := infra.NewImageEngine(EngineOptions)
if err != nil {
return nil, err
}
@@ -93,8 +94,8 @@ func ContainerEngine() entities.ContainerEngine {
// NewContainerEngine is a wrapper for building an ContainerEngine to be used for PreRunE functions
func NewContainerEngine(cmd *cobra.Command, args []string) (entities.ContainerEngine, error) {
if containerEngine == nil {
- EngineOpts.FlagSet = cmd.Flags()
- engine, err := infra.NewContainerEngine(EngineOpts)
+ EngineOptions.FlagSet = cmd.Flags()
+ engine, err := infra.NewContainerEngine(EngineOptions)
if err != nil {
return nil, err
}
@@ -109,3 +110,18 @@ func SubCommandExists(cmd *cobra.Command, args []string) error {
}
return errors.Errorf("missing command '%[1]s COMMAND'\nTry '%[1]s --help' for more information.", cmd.CommandPath())
}
+
+type podmanContextKey string
+
+var podmanFactsKey = podmanContextKey("engineOptions")
+
+func NewOptions(ctx context.Context, facts *entities.EngineOptions) context.Context {
+ return context.WithValue(ctx, podmanFactsKey, facts)
+}
+
+func Options(cmd *cobra.Command) (*entities.EngineOptions, error) {
+ if f, ok := cmd.Context().Value(podmanFactsKey).(*entities.EngineOptions); ok {
+ return f, errors.New("Command Context ")
+ }
+ return nil, nil
+}
diff --git a/cmd/podmanV2/registry/remote.go b/cmd/podmanV2/registry/remote.go
new file mode 100644
index 000000000..32a231ac4
--- /dev/null
+++ b/cmd/podmanV2/registry/remote.go
@@ -0,0 +1,9 @@
+package registry
+
+import (
+ "github.com/containers/libpod/pkg/domain/entities"
+)
+
+func IsRemote() bool {
+ return EngineOptions.EngineMode == entities.TunnelMode
+}
diff --git a/cmd/podmanV2/root.go b/cmd/podmanV2/root.go
index 2becd126d..68e8b4531 100644
--- a/cmd/podmanV2/root.go
+++ b/cmd/podmanV2/root.go
@@ -26,12 +26,13 @@ func init() {
var dummyVersion bool
// TODO had to disable shorthand -v for version due to -v rm with volume
rootCmd.PersistentFlags().BoolVar(&dummyVersion, "version", false, "Version of Podman")
- rootCmd.PersistentFlags().StringVarP(&registry.EngineOpts.Uri, "remote", "r", "", "URL to access Podman service")
- rootCmd.PersistentFlags().StringSliceVar(&registry.EngineOpts.Identities, "identity", []string{}, "path to SSH identity file")
+ rootCmd.PersistentFlags().StringVarP(&registry.EngineOptions.Uri, "remote", "r", "", "URL to access Podman service")
+ rootCmd.PersistentFlags().StringSliceVar(&registry.EngineOptions.Identities, "identity", []string{}, "path to SSH identity file")
}
func Execute() {
- if err := rootCmd.Execute(); err != nil {
+ o := registry.NewOptions(rootCmd.Context(), &registry.EngineOptions)
+ if err := rootCmd.ExecuteContext(o); err != nil {
fmt.Fprintln(os.Stderr, "Error:", err.Error())
} else if registry.GetExitCode() == define.ExecErrorCodeGeneric {
// The exitCode modified from define.ExecErrorCodeGeneric,
diff --git a/cmd/podmanV2/utils/remote.go b/cmd/podmanV2/utils/remote.go
deleted file mode 100644
index d0c8a272d..000000000
--- a/cmd/podmanV2/utils/remote.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package utils
-
-import (
- "github.com/containers/libpod/cmd/podmanV2/registry"
- "github.com/containers/libpod/pkg/domain/entities"
-)
-
-func IsRemote() bool {
- return registry.EngineOpts.EngineMode == entities.TunnelMode
-}
diff --git a/pkg/domain/entities/engine.go b/pkg/domain/entities/engine.go
index 08ef1df92..8553f5326 100644
--- a/pkg/domain/entities/engine.go
+++ b/pkg/domain/entities/engine.go
@@ -19,16 +19,12 @@ func (m EngineMode) String() string {
return string(m)
}
-// FIXME: merge EngineOptions and EngineFlags
type EngineOptions struct {
Uri string
Identities []string
FlagSet *pflag.FlagSet
- Flags EngineFlags
EngineMode EngineMode
-}
-type EngineFlags struct {
CGroupManager string
CniConfigDir string
ConmonPath string
@@ -61,9 +57,9 @@ type EngineFlags struct {
IgnoreHosts bool
}
-func NewEngineOptions() (EngineFlags, error) {
+func NewEngineOptions() (EngineOptions, error) {
u, _ := user.Current()
- return EngineFlags{
+ return EngineOptions{
CGroupManager: define.SystemdCgroupsManager,
CniConfigDir: "",
Config: "",
diff --git a/pkg/domain/infra/runtime_abi.go b/pkg/domain/infra/runtime_abi.go
index 31f832423..f11026571 100644
--- a/pkg/domain/infra/runtime_abi.go
+++ b/pkg/domain/infra/runtime_abi.go
@@ -12,27 +12,27 @@ import (
)
// NewContainerEngine factory provides a libpod runtime for container-related operations
-func NewContainerEngine(opts entities.EngineOptions) (entities.ContainerEngine, error) {
- switch opts.EngineMode {
+func NewContainerEngine(facts entities.EngineOptions) (entities.ContainerEngine, error) {
+ switch facts.EngineMode {
case entities.ABIMode:
- r, err := NewLibpodRuntime(opts.FlagSet, opts.Flags)
+ r, err := NewLibpodRuntime(facts.FlagSet, facts)
return r, err
case entities.TunnelMode:
- ctx, err := bindings.NewConnection(context.Background(), opts.Uri, opts.Identities...)
+ ctx, err := bindings.NewConnection(context.Background(), facts.Uri, facts.Identities...)
return &tunnel.ContainerEngine{ClientCxt: ctx}, err
}
- return nil, fmt.Errorf("runtime mode '%v' is not supported", opts.EngineMode)
+ return nil, fmt.Errorf("runtime mode '%v' is not supported", facts.EngineMode)
}
// NewContainerEngine factory provides a libpod runtime for image-related operations
-func NewImageEngine(opts entities.EngineOptions) (entities.ImageEngine, error) {
- switch opts.EngineMode {
+func NewImageEngine(facts entities.EngineOptions) (entities.ImageEngine, error) {
+ switch facts.EngineMode {
case entities.ABIMode:
- r, err := NewLibpodImageRuntime(opts.FlagSet, opts.Flags)
+ r, err := NewLibpodImageRuntime(facts.FlagSet, facts)
return r, err
case entities.TunnelMode:
- ctx, err := bindings.NewConnection(context.Background(), opts.Uri, opts.Identities...)
+ ctx, err := bindings.NewConnection(context.Background(), facts.Uri, facts.Identities...)
return &tunnel.ImageEngine{ClientCxt: ctx}, err
}
- return nil, fmt.Errorf("runtime mode '%v' is not supported", opts.EngineMode)
+ return nil, fmt.Errorf("runtime mode '%v' is not supported", facts.EngineMode)
}
diff --git a/pkg/domain/infra/runtime_image_proxy.go b/pkg/domain/infra/runtime_image_proxy.go
index d2e66c08c..befc66b9a 100644
--- a/pkg/domain/infra/runtime_image_proxy.go
+++ b/pkg/domain/infra/runtime_image_proxy.go
@@ -12,7 +12,7 @@ import (
// 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.EngineOptions) (entities.ImageEngine, error) {
r, err := GetRuntime(context.Background(), flags, opts)
if err != nil {
return nil, err
diff --git a/pkg/domain/infra/runtime_libpod.go b/pkg/domain/infra/runtime_libpod.go
index b835152bf..730ded2e0 100644
--- a/pkg/domain/infra/runtime_libpod.go
+++ b/pkg/domain/infra/runtime_libpod.go
@@ -22,11 +22,11 @@ type engineOpts struct {
migrate bool
noStore bool
withFDS bool
- flags entities.EngineFlags
+ flags entities.EngineOptions
}
// 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.EngineOptions, newRuntime string) (*libpod.Runtime, error) {
return getRuntime(ctx, fs, &engineOpts{
name: newRuntime,
renumber: false,
@@ -38,7 +38,7 @@ func GetRuntimeMigrate(ctx context.Context, fs *flag.FlagSet, ef entities.Engine
}
// 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.EngineOptions) (*libpod.Runtime, error) {
return getRuntime(ctx, fs, &engineOpts{
renumber: false,
migrate: false,
@@ -49,7 +49,7 @@ func GetRuntimeDisableFDs(ctx context.Context, fs *flag.FlagSet, ef entities.Eng
}
// 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.EngineOptions) (*libpod.Runtime, error) {
return getRuntime(ctx, fs, &engineOpts{
renumber: true,
migrate: false,
@@ -60,7 +60,7 @@ func GetRuntimeRenumber(ctx context.Context, fs *flag.FlagSet, ef entities.Engin
}
// 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.EngineOptions) (*libpod.Runtime, error) {
return getRuntime(ctx, flags, &engineOpts{
renumber: false,
migrate: false,
@@ -71,7 +71,7 @@ func GetRuntime(ctx context.Context, flags *flag.FlagSet, ef entities.EngineFlag
}
// 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.EngineOptions) (*libpod.Runtime, error) {
return getRuntime(ctx, fs, &engineOpts{
renumber: false,
migrate: false,
diff --git a/pkg/domain/infra/runtime_proxy.go b/pkg/domain/infra/runtime_proxy.go
index 4095ae6e2..2e38c74b9 100644
--- a/pkg/domain/infra/runtime_proxy.go
+++ b/pkg/domain/infra/runtime_proxy.go
@@ -12,7 +12,7 @@ import (
// ContainerEngine Proxy will be EOL'ed after podmanV2 is separated from libpod repo
-func NewLibpodRuntime(flags *flag.FlagSet, opts entities.EngineFlags) (entities.ContainerEngine, error) {
+func NewLibpodRuntime(flags *flag.FlagSet, opts entities.EngineOptions) (entities.ContainerEngine, error) {
r, err := GetRuntime(context.Background(), flags, opts)
if err != nil {
return nil, err
diff --git a/pkg/domain/infra/runtime_tunnel.go b/pkg/domain/infra/runtime_tunnel.go
index 5816ef0c0..dc04b4e53 100644
--- a/pkg/domain/infra/runtime_tunnel.go
+++ b/pkg/domain/infra/runtime_tunnel.go
@@ -11,25 +11,25 @@ import (
"github.com/containers/libpod/pkg/domain/infra/tunnel"
)
-func NewContainerEngine(opts entities.EngineOptions) (entities.ContainerEngine, error) {
- switch opts.EngineMode {
+func NewContainerEngine(facts entities.EngineOptions) (entities.ContainerEngine, error) {
+ switch facts.EngineMode {
case entities.ABIMode:
return nil, fmt.Errorf("direct runtime not supported")
case entities.TunnelMode:
- ctx, err := bindings.NewConnection(context.Background(), opts.Uri, opts.Identities...)
+ ctx, err := bindings.NewConnection(context.Background(), facts.Uri, facts.Identities...)
return &tunnel.ContainerEngine{ClientCxt: ctx}, err
}
- return nil, fmt.Errorf("runtime mode '%v' is not supported", opts.EngineMode)
+ return nil, fmt.Errorf("runtime mode '%v' is not supported", facts.EngineMode)
}
// NewImageEngine factory provides a libpod runtime for image-related operations
-func NewImageEngine(opts entities.EngineOptions) (entities.ImageEngine, error) {
- switch opts.EngineMode {
+func NewImageEngine(facts entities.EngineOptions) (entities.ImageEngine, error) {
+ switch facts.EngineMode {
case entities.ABIMode:
return nil, fmt.Errorf("direct image runtime not supported")
case entities.TunnelMode:
- ctx, err := bindings.NewConnection(context.Background(), opts.Uri, opts.Identities...)
+ ctx, err := bindings.NewConnection(context.Background(), facts.Uri, facts.Identities...)
return &tunnel.ImageEngine{ClientCxt: ctx}, err
}
- return nil, fmt.Errorf("runtime mode '%v' is not supported", opts.EngineMode)
+ return nil, fmt.Errorf("runtime mode '%v' is not supported", facts.EngineMode)
}