func restGetRunningForHost(w *rest.ResponseWriter, r *rest.Request, client *node.ControlClient) { hostID, err := url.QueryUnescape(r.PathParam("hostId")) if err != nil { restBadRequest(w, err) return } var services []dao.RunningService err = client.GetRunningServicesForHost(hostID, &services) if err != nil { glog.Errorf("Could not get services: %v", err) restServerError(w, err) return } if services == nil { glog.V(3).Info("Running services was nil, returning empty list instead") services = []dao.RunningService{} } glog.V(2).Infof("Returning %d running services for host %s", len(services), hostID) w.WriteJson(&services) }