Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't setup the Image/ContainerEngine when calling a cmd with subcmds #7564

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cmd/podman/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
// TODO: Remove trace statement in podman V2.1
logrus.Debugf("Called %s.PersistentPreRunE(%s)", cmd.Name(), strings.Join(os.Args, " "))

// Help is a special case, no need for more setup
if cmd.Name() == "help" {
// Help and commands with subcommands are special cases, no need for more setup
if cmd.Name() == "help" || cmd.HasSubCommands() {
return nil
}

Expand Down Expand Up @@ -204,8 +204,8 @@ func persistentPostRunE(cmd *cobra.Command, args []string) error {
// TODO: Remove trace statement in podman V2.1
logrus.Debugf("Called %s.PersistentPostRunE(%s)", cmd.Name(), strings.Join(os.Args, " "))

// Help is a special case, no need for more cleanup
if cmd.Name() == "help" {
// Help and commands with subcommands are special cases, no need for more cleanup
if cmd.Name() == "help" || cmd.HasSubCommands() {
return nil
}

Expand Down
11 changes: 11 additions & 0 deletions test/system/001-basic.bats
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ function setup() {
is "$output" "Error: unknown flag: --remote" "podman version --remote"
}

# Check that just calling "podman-remote" prints the usage message even
# without a running endpoint. Use "podman --remote" for this as this works the same.
@test "podman-remote: check for command usage message without a running endpoint" {
if is_remote; then
skip "only applicable on a local run since this requires no endpoint"
fi

run_podman 125 --remote
is "$output" "Error: missing command 'podman COMMAND'" "podman remote show usage message without running endpoint"
}

# This is for development only; it's intended to make sure our timeout
# in run_podman continues to work. This test should never run in production
# because it will, by definition, fail.
Expand Down