Skip to content

Conversation

@jwhonce
Copy link

@jwhonce jwhonce commented Nov 1, 2019

Signed-off-by: Jhon Honce jhonce@redhat.com

Signed-off-by: Jhon Honce <jhonce@redhat.com>

"github.com/containers/libpod/libpod"
log "github.com/sirupsen/logrus"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove line

func NewServer(runtime *libpod.Runtime) (*HttpServer, error) {
listeners, err := activation.Listeners()
if err != nil {
log.Panicf("Cannot retrieve listeners: %s", err)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not return errors.Wrapf?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Panic is easier for now. Will move to errors once we wire everything in.

log.Panicf("Cannot retrieve listeners: %s", err)
}
if len(listeners) != 1 {
log.Panicf("unexpected number of socket activation (%d != 1)", len(listeners))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not return errors.Errorf?

defer cancel()
server.SetKeepAlivesEnabled(false)
if err := server.Shutdown(ctx); err != nil {
log.Panicf("cannot gracefully shut down the http server: %s", err)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we just log.Errorf?

func (s *HttpServer) Serve() error {
err := http.Serve(s.listener, nil)
if err != nil {
log.Panicf("Cannot start server: %s", err)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return errors.Wrapf

Use cd cmd/service && go build .

$ systemd-socket-activate -l 8081 cmd/service/service &
$ curl http://localhost:8081/v1.24/images/json

Signed-off-by: Jhon Honce <jhonce@redhat.com>
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Signed-off-by: Jhon Honce <jhonce@redhat.com>
@baude baude merged commit da8ec26 into baude:apiv2 Nov 1, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants