github.com/cloud-foundations/dominator@v0.0.0-20221004181915-6e4fee580046/imageserver/httpd/listBuildLog.go (about) 1 package httpd 2 3 import ( 4 "bufio" 5 "fmt" 6 "net/http" 7 ) 8 9 func (s state) listBuildLogHandler(w http.ResponseWriter, req *http.Request) { 10 writer := bufio.NewWriter(w) 11 defer writer.Flush() 12 imageName := req.URL.RawQuery 13 fmt.Fprintf(writer, "<title>image %s</title>\n", imageName) 14 fmt.Fprintln(writer, "<body>") 15 fmt.Fprintln(writer, "<h3>") 16 image := s.imageDataBase.GetImage(imageName) 17 if image == nil { 18 fmt.Fprintf(writer, "Image: %s UNKNOWN!\n", imageName) 19 return 20 } 21 if image.BuildLog == nil { 22 fmt.Fprintf(writer, "No build log for image: %s\n", imageName) 23 return 24 } 25 if image.BuildLog.Object == nil { 26 fmt.Fprintf(writer, "No build log data for image: %s\n", imageName) 27 return 28 } 29 fmt.Fprintf(writer, "Build log for image: %s<br>\n", imageName) 30 fmt.Fprintln(writer, "</h3>") 31 listObject(writer, s.objectServer, image.BuildLog.Object) 32 fmt.Fprintln(writer, "</body>") 33 }