Return 404 for all network operations without network controller.

This will prevent the api from trying to serve network requests in
systems where libnetwork is not enabled, returning 404 responses in any
case.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: eb982e7c00192c8306f9c420fb469f087c7b161d
Component: engine
This commit is contained in:
David Calavera
2015-10-16 18:45:54 -04:00
parent f246159061
commit b8b4d2b3f7
4 changed files with 38 additions and 6 deletions

View File

@ -170,6 +170,7 @@ func (s *Server) makeHTTPHandler(handler httputils.APIFunc) http.HandlerFunc {
func (s *Server) InitRouters(d *daemon.Daemon) {
s.addRouter(local.NewRouter(d))
s.addRouter(network.NewRouter(d))
for _, srv := range s.servers {
srv.srv.Handler = s.CreateMux()
}