diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-05-08 11:09:48 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-05-08 11:09:48 -0400 |
commit | 69f62a1a9c09818f888247fec96344cae6e4b6ff (patch) | |
tree | 265c2eb6ddcb5dfe1240889a19bc8338566f2f27 /cmd/podman/registry/config.go | |
parent | ae9892e23e378a6bd96884d09b886757c425ac58 (diff) | |
download | podman-69f62a1a9c09818f888247fec96344cae6e4b6ff.tar.gz podman-69f62a1a9c09818f888247fec96344cae6e4b6ff.tar.bz2 podman-69f62a1a9c09818f888247fec96344cae6e4b6ff.zip |
default to tunnel without ABISupport tag
When compiling a Linux binary without ABISupport, default to use the
tunnel. The behaviour is expected in `podman-remote`.
Also set a default for the remote flag so `podman-remote` works OOB.
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/registry/config.go')
-rw-r--r-- | cmd/podman/registry/config.go | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/cmd/podman/registry/config.go b/cmd/podman/registry/config.go index fc6eb538e..49d5bca74 100644 --- a/cmd/podman/registry/config.go +++ b/cmd/podman/registry/config.go @@ -22,6 +22,7 @@ const ( var ( podmanOptions entities.PodmanConfig podmanSync sync.Once + abiSupport = false ) // PodmanConfig returns an entities.PodmanConfig built up from @@ -39,23 +40,31 @@ func newPodmanConfig() { var mode entities.EngineMode switch runtime.GOOS { - case "darwin": - fallthrough - case "windows": + case "darwin", "windows": mode = entities.TunnelMode case "linux": - mode = entities.ABIMode + // Some linux clients might only be compiled without ABI + // support (e.g., podman-remote). + if abiSupport { + mode = entities.ABIMode + } else { + mode = entities.TunnelMode + } default: fmt.Fprintf(os.Stderr, "%s is not a supported OS", runtime.GOOS) os.Exit(1) } - // cobra.Execute() may not be called yet, so we peek at os.Args. - for _, v := range os.Args { - // Prefix checking works because of how default EngineMode's - // have been defined. - if strings.HasPrefix(v, "--remote") { - mode = entities.TunnelMode + // Check if need to fallback to the tunnel mode if --remote is used. + if abiSupport && mode == entities.ABIMode { + // cobra.Execute() may not be called yet, so we peek at os.Args. + for _, v := range os.Args { + // Prefix checking works because of how default EngineMode's + // have been defined. + if strings.HasPrefix(v, "--remote") { + mode = entities.TunnelMode + break + } } } |