summaryrefslogtreecommitdiff
path: root/pkg/domain/infra
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2020-03-23 10:27:32 -0700
committerJhon Honce <jhonce@redhat.com>2020-03-24 11:03:13 -0700
commit77a2af8817284d134ea1f30f0b06291a5b05c5a0 (patch)
treef6ed82f9c435c30b44d5c820502607ba60e89282 /pkg/domain/infra
parentc29a4c69044c02eee564fc72c64144b2a76d1d73 (diff)
downloadpodman-77a2af8817284d134ea1f30f0b06291a5b05c5a0.tar.gz
podman-77a2af8817284d134ea1f30f0b06291a5b05c5a0.tar.bz2
podman-77a2af8817284d134ea1f30f0b06291a5b05c5a0.zip
Combine GlobalFlags and EngineFlags into EngineOptions
* EngineOptions obtained in command via `opt, err := registry.Options(cmd)` Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/domain/infra')
-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
5 files changed, 26 insertions, 26 deletions
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)
}