Merge pull request #13296 from Romain-Geissler-1A/url-and-connection-implies-remote

Option --url and --connection should imply --remote.
This commit is contained in:
OpenShift Merge Robot
2022-02-21 15:21:37 -05:00
committed by GitHub
3 changed files with 21 additions and 0 deletions

View File

@ -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
}

View File

@ -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>]`

View File

@ -126,6 +126,17 @@ See 'podman version --help'" "podman version --remote"
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