aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain Geissler <romain.geissler@amadeus.com>2022-02-19 13:57:20 +0000
committerRomain Geissler <romain.geissler@amadeus.com>2022-02-19 14:53:37 +0000
commit23a7f4e0deffb075d24b3e731246269d5a35b748 (patch)
tree05ac787436fe651dcedcb9ebfbf37b8aea6d7970
parenta88ea2c68b1ef01077a53b1c568b85667dcbc1e2 (diff)
downloadpodman-23a7f4e0deffb075d24b3e731246269d5a35b748.tar.gz
podman-23a7f4e0deffb075d24b3e731246269d5a35b748.tar.bz2
podman-23a7f4e0deffb075d24b3e731246269d5a35b748.zip
Option --url and --connection should imply --remote.
Closes #13242 Signed-off-by: Romain Geissler <romain.geissler@amadeus.com>
-rw-r--r--cmd/podman/registry/remote.go8
-rw-r--r--docs/source/markdown/podman.1.md2
-rw-r--r--test/system/001-basic.bats11
3 files changed, 21 insertions, 0 deletions
diff --git a/cmd/podman/registry/remote.go b/cmd/podman/registry/remote.go
index f05d8f7b4..181ef6b4a 100644
--- a/cmd/podman/registry/remote.go
+++ b/cmd/podman/registry/remote.go
@@ -30,6 +30,12 @@ func IsRemote() bool {
fs.Usage = func() {}
fs.SetInterspersed(false)
fs.BoolVarP(&remoteFromCLI.Value, "remote", "r", remote, "")
+ connectionFlagName := "connection"
+ ignoredConnection := ""
+ fs.StringVarP(&ignoredConnection, connectionFlagName, "c", "", "")
+ urlFlagName := "url"
+ ignoredURL := ""
+ fs.StringVar(&ignoredURL, urlFlagName, "", "")
// The shell completion logic will call a command called "__complete" or "__completeNoDesc"
// This command will always be the second argument
@@ -39,6 +45,8 @@ func IsRemote() bool {
start = 2
}
_ = fs.Parse(os.Args[start:])
+ // --connection or --url implies --remote
+ remoteFromCLI.Value = remoteFromCLI.Value || fs.Changed(connectionFlagName) || fs.Changed(urlFlagName)
})
return podmanOptions.EngineMode == entities.TunnelMode || remoteFromCLI.Value
}
diff --git a/docs/source/markdown/podman.1.md b/docs/source/markdown/podman.1.md
index b318001e4..4d3e92dd2 100644
--- a/docs/source/markdown/podman.1.md
+++ b/docs/source/markdown/podman.1.md
@@ -42,6 +42,7 @@ and "$graphroot/networks" as rootless.
#### **--connection**, **-c**
Connection to use for remote podman, including Mac and Windows (excluding WSL2) machines, (Default connection is configured in `containers.conf`)
+Setting this option will switch the **--remote** option to true.
Remote connections use local containers.conf for default.
#### **--conmon**
@@ -108,6 +109,7 @@ environment variable is set, the **--remote** option defaults to true.
#### **--url**=*value*
URL to access Podman service (default from `containers.conf`, rootless `unix://run/user/$UID/podman/podman.sock` or as root `unix://run/podman/podman.sock`).
+Setting this option will switch the **--remote** option to true.
- `CONTAINER_HOST` is of the format `<schema>://[<user[:<password>]@]<host>[:<port>][<path>]`
diff --git a/test/system/001-basic.bats b/test/system/001-basic.bats
index 9b0a71285..721fb4bca 100644
--- a/test/system/001-basic.bats
+++ b/test/system/001-basic.bats
@@ -108,6 +108,17 @@ function setup() {
if grep -- " --remote " <<<"$output"; then
die "podman --help, with CONTAINER_CONNECTION set, is showing --remote"
fi
+
+ # When it detects --url or --connection, --remote is not an option
+ run_podman --url foobar --help
+ if grep -- " --remote " <<<"$output"; then
+ die "podman --help, with --url set, is showing --remote"
+ fi
+
+ run_podman --connection foobar --help
+ if grep -- " --remote " <<<"$output"; then
+ die "podman --help, with --connection set, is showing --remote"
+ fi
}
# Check that just calling "podman-remote" prints the usage message even