server: Lookup infra containers as well in endpoint
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
138a40540f
commit
e9378f23ca
1 changed files with 5 additions and 2 deletions
|
@ -48,10 +48,13 @@ func (s *Server) StartInfoEndpoints() error {
|
||||||
mux.Get("/containers/:id", http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
mux.Get("/containers/:id", http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||||
containerID := bone.GetValue(req, "id")
|
containerID := bone.GetValue(req, "id")
|
||||||
ctr := s.GetContainer(containerID)
|
ctr := s.GetContainer(containerID)
|
||||||
|
if ctr == nil {
|
||||||
|
ctr = s.getInfraContainer(containerID)
|
||||||
if ctr == nil {
|
if ctr == nil {
|
||||||
http.Error(w, fmt.Sprintf("container with id: %s not found", containerID), http.StatusNotFound)
|
http.Error(w, fmt.Sprintf("container with id: %s not found", containerID), http.StatusNotFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ctrState := ctr.State()
|
ctrState := ctr.State()
|
||||||
if ctrState == nil {
|
if ctrState == nil {
|
||||||
http.Error(w, fmt.Sprintf("container %s state is nil", containerID), http.StatusNotFound)
|
http.Error(w, fmt.Sprintf("container %s state is nil", containerID), http.StatusNotFound)
|
||||||
|
|
Loading…
Reference in a new issue