mirror of
https://github.com/containers/podman.git
synced 2025-05-22 01:27:07 +08:00
podman-remote does not support most of the global flags
podman-remote --help is showing a bunch of global flags that it does not support Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -154,6 +154,7 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
}
|
||||
|
||||
if !registry.IsRemote() {
|
||||
if cmd.Flag("cpu-profile").Changed {
|
||||
f, err := os.Create(cfg.CPUProfile)
|
||||
if err != nil {
|
||||
@ -181,7 +182,7 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
|
||||
if err := parallel.SetMaxThreads(uint(cfg.MaxWorks)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
// Setup Rootless environment, IFF:
|
||||
// 1) in ABI mode
|
||||
// 2) running as non-root
|
||||
@ -206,6 +207,7 @@ func persistentPostRunE(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
cfg := registry.PodmanConfig()
|
||||
if !registry.IsRemote() {
|
||||
if cmd.Flag("cpu-profile").Changed {
|
||||
pprof.StopCPUProfile()
|
||||
}
|
||||
@ -213,6 +215,7 @@ func persistentPostRunE(cmd *cobra.Command, args []string) error {
|
||||
cfg.Span.Finish()
|
||||
cfg.SpanCloser.Close()
|
||||
}
|
||||
}
|
||||
|
||||
registry.ImageEngine().Shutdown(registry.Context())
|
||||
registry.ContainerEngine().Shutdown(registry.Context())
|
||||
@ -249,12 +252,18 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {
|
||||
srv, uri, ident := resolveDestination()
|
||||
|
||||
lFlags := cmd.Flags()
|
||||
lFlags.BoolVarP(&opts.Remote, "remote", "r", false, "Access remote Podman service (default false)")
|
||||
lFlags.StringVarP(&opts.Engine.ActiveService, "connection", "c", srv, "Connection to use for remote Podman service")
|
||||
lFlags.StringVar(&opts.URI, "url", uri, "URL to access Podman service (CONTAINER_HOST)")
|
||||
lFlags.StringVar(&opts.Identity, "identity", ident, "path to SSH identity file, (CONTAINER_SSHKEY)")
|
||||
|
||||
lFlags.BoolVarP(&opts.Remote, "remote", "r", false, "Access remote Podman service (default false)")
|
||||
pFlags := cmd.PersistentFlags()
|
||||
if registry.IsRemote() {
|
||||
if err := lFlags.MarkHidden("remote"); err != nil {
|
||||
logrus.Warnf("unable to mark --remote flag as hidden: %s", err.Error())
|
||||
}
|
||||
opts.Remote = true
|
||||
} else {
|
||||
pFlags.StringVar(&cfg.Engine.CgroupManager, "cgroup-manager", cfg.Engine.CgroupManager, "Cgroup manager to use (\"cgroupfs\"|\"systemd\")")
|
||||
pFlags.StringVar(&opts.CPUProfile, "cpu-profile", "", "Path for the cpu profiling results")
|
||||
pFlags.StringVar(&opts.ConmonPath, "conmon", "", "Path of the conmon binary")
|
||||
@ -276,11 +285,6 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {
|
||||
pFlags.StringVar(&opts.Engine.TmpDir, "tmpdir", "", "Path to the tmp directory for libpod state content.\n\nNote: use the environment variable 'TMPDIR' to change the temporary storage location for container images, '/var/tmp'.\n")
|
||||
pFlags.BoolVar(&opts.Trace, "trace", false, "Enable opentracing output (default false)")
|
||||
|
||||
// Override default --help information of `--help` global flag
|
||||
var dummyHelp bool
|
||||
pFlags.BoolVar(&dummyHelp, "help", false, "Help for podman")
|
||||
pFlags.StringVar(&logLevel, "log-level", logLevel, fmt.Sprintf("Log messages above specified level (%s)", strings.Join(logLevels, ", ")))
|
||||
|
||||
// Hide these flags for both ABI and Tunneling
|
||||
for _, f := range []string{
|
||||
"cpu-profile",
|
||||
@ -293,6 +297,11 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {
|
||||
logrus.Warnf("unable to mark %s flag as hidden: %s", f, err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
// Override default --help information of `--help` global flag
|
||||
var dummyHelp bool
|
||||
pFlags.BoolVar(&dummyHelp, "help", false, "Help for podman")
|
||||
pFlags.StringVar(&logLevel, "log-level", logLevel, fmt.Sprintf("Log messages above specified level (%s)", strings.Join(logLevels, ", ")))
|
||||
|
||||
// Only create these flags for ABI connections
|
||||
if !registry.IsRemote() {
|
||||
|
@ -160,6 +160,14 @@ Print the version
|
||||
|
||||
Podman can set up environment variables from env of [engine] table in containers.conf. These variables can be overridden by passing environment variables before the `podman` commands.
|
||||
|
||||
## Remote Access
|
||||
|
||||
The Podman command can be used with remote services using the `--remote` flag. Connections can
|
||||
be made using local unix domain sockets, ssh or directly to tcp sockets. When specifying the
|
||||
podman --remote flag, only the global options `--url`, `--identity`, `--log-level`, `--connection` are used.
|
||||
|
||||
Connection information can also be managed using the containers.conf file.
|
||||
|
||||
## Exit Status
|
||||
|
||||
The exit code from `podman` gives information about why the container
|
||||
|
@ -61,7 +61,7 @@ function setup() {
|
||||
is "$output" ".*Server:" "podman --remote: contacts server"
|
||||
|
||||
# This was failing: "podman --foo --bar --remote".
|
||||
PODMAN="${podman_non_remote} --tmpdir /var/tmp --log-level=error ${podman_args[@]} --remote" run_podman version
|
||||
PODMAN="${podman_non_remote} --log-level=error ${podman_args[@]} --remote" run_podman version
|
||||
is "$output" ".*Server:" "podman [flags] --remote: contacts server"
|
||||
|
||||
# ...but no matter what, --remote is never allowed after subcommand
|
||||
|
Reference in New Issue
Block a user