Skip to content

Commit

Permalink
Merge pull request #16070 from boaz0/fix_system_service_uri
Browse files Browse the repository at this point in the history
Return error in podman system service if URI scheme is not unix/tcp
  • Loading branch information
openshift-merge-robot authored Oct 6, 2022
2 parents 13a1c55 + d4f622d commit eb85012
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/podman/system/service_abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func restService(flags *pflag.FlagSet, cfg *entities.PodmanConfig, opts entities
return fmt.Errorf("unable to create socket %v: %w", host, err)
}
default:
logrus.Debugf("Attempting API Service endpoint scheme %q", uri.Scheme)
return fmt.Errorf("API Service endpoint scheme %q is not supported. Try tcp://%s or unix:/%s", uri.Scheme, opts.URI, opts.URI)
}
libpodRuntime.SetRemoteURI(uri.String())
}
Expand Down
8 changes: 8 additions & 0 deletions test/system/251-system-service.bats
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ function teardown() {
basic_teardown
}

@test "podman systerm service <bad_scheme_uri> returns error" {
skip_if_remote "podman system service unavailable over remote"
run_podman 125 system service localhost:9292
is "$output" "Error: API Service endpoint scheme \"localhost\" is not supported. Try tcp://localhost:9292 or unix:/localhost:9292"

run_podman 125 system service myunix.sock
is "$output" "Error: API Service endpoint scheme \"\" is not supported. Try tcp://myunix.sock or unix:/myunix.sock"
}

@test "podman-system-service containers survive service stop" {
skip_if_remote "podman system service unavailable over remote"
Expand Down

0 comments on commit eb85012

Please sign in to comment.