diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2022-04-27 15:48:04 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2022-05-04 12:11:32 -0400 |
commit | 5fa6f686dbeaf04e1df8a888b9458c3d7f42eee8 (patch) | |
tree | c1700e0bbdfd923e6a76406bc6078df80f1d74b8 /pkg/api/server | |
parent | b1e9ea38e5a680afb9294cb8a451311991d94765 (diff) | |
download | podman-5fa6f686dbeaf04e1df8a888b9458c3d7f42eee8.tar.gz podman-5fa6f686dbeaf04e1df8a888b9458c3d7f42eee8.tar.bz2 podman-5fa6f686dbeaf04e1df8a888b9458c3d7f42eee8.zip |
Report correct RemoteURI
Rather than assuming a filesystem path, the API service URI is recorded
in the libpod runtime configuration and then reported as requested.
Note: All schemes other than "unix" are hard-coded to report URI exists.
Fixes #12023
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/api/server')
-rw-r--r-- | pkg/api/server/server.go | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/pkg/api/server/server.go b/pkg/api/server/server.go index a906a01f1..7f5537fb4 100644 --- a/pkg/api/server/server.go +++ b/pkg/api/server/server.go @@ -20,7 +20,6 @@ import ( "github.com/containers/podman/v4/pkg/api/server/idle" "github.com/containers/podman/v4/pkg/api/types" "github.com/containers/podman/v4/pkg/domain/entities" - "github.com/coreos/go-systemd/v22/activation" "github.com/coreos/go-systemd/v22/daemon" "github.com/gorilla/mux" "github.com/gorilla/schema" @@ -65,25 +64,7 @@ func NewServerWithSettings(runtime *libpod.Runtime, listener net.Listener, opts } func newServer(runtime *libpod.Runtime, listener net.Listener, opts entities.ServiceOptions) (*APIServer, error) { - // If listener not provided try socket activation protocol - if listener == nil { - if _, found := os.LookupEnv("LISTEN_PID"); !found { - return nil, fmt.Errorf("no service listener provided and socket activation protocol is not active") - } - - listeners, err := activation.Listeners() - if err != nil { - return nil, fmt.Errorf("cannot retrieve file descriptors from systemd: %w", err) - } - if len(listeners) != 1 { - return nil, fmt.Errorf("wrong number of file descriptors for socket activation protocol (%d != 1)", len(listeners)) - } - listener = listeners[0] - // note that activation.Listeners() return nil when it cannot listen on the fd (i.e. udp connection) - if listener == nil { - return nil, fmt.Errorf("unexpected fd received from systemd: cannot listen on it") - } - } + logrus.Infof("API service listening on %q. URI: %q", listener.Addr(), runtime.RemoteURI()) if opts.CorsHeaders == "" { logrus.Debug("CORS Headers were not set") } else { |