-
Notifications
You must be signed in to change notification settings - Fork 0
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
Initial commit on compatible API #6
Conversation
Signed-off-by: Jhon Honce <jhonce@redhat.com>
|
||
"github.com/containers/libpod/libpod" | ||
log "github.com/sirupsen/logrus" | ||
|
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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>
Signed-off-by: Jhon Honce jhonce@redhat.com