allow download of named overlay
This commit is contained in:
@@ -14,6 +14,7 @@ type parserInfo struct {
|
||||
remoteport int
|
||||
assetkey string
|
||||
uuid string
|
||||
overlay string
|
||||
}
|
||||
|
||||
func parseReq(req *http.Request) (parserInfo, error) {
|
||||
@@ -35,7 +36,9 @@ func parseReq(req *http.Request) (parserInfo, error) {
|
||||
if len(req.URL.Query()["uuid"]) > 0 {
|
||||
ret.uuid = req.URL.Query()["uuid"][0]
|
||||
}
|
||||
|
||||
if len(req.URL.Query()["overlay"]) > 0 {
|
||||
ret.overlay = req.URL.Query()["overlay"][0]
|
||||
}
|
||||
if ret.hwaddr == "" {
|
||||
return ret, errors.New("no hwaddr encoded in GET")
|
||||
}
|
||||
|
||||
@@ -45,8 +45,16 @@ func RuntimeOverlaySend(w http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if len(node.RuntimeOverlay.GetSlice()) != 0 {
|
||||
if rinfo.overlay != "" {
|
||||
fileName := overlay.OverlayImage(node.Id.Get(), []string{rinfo.overlay})
|
||||
if conf.Warewulf.AutobuildOverlays {
|
||||
_ = overlay.BuildOverlay(node, []string{rinfo.overlay})
|
||||
}
|
||||
err := sendFile(w, fileName, node.Id.Get())
|
||||
if err != nil {
|
||||
daemonLogf("ERROR: %s\n", err)
|
||||
}
|
||||
} else if len(node.RuntimeOverlay.GetSlice()) != 0 {
|
||||
fileName := overlay.OverlayImage(node.Id.Get(), node.RuntimeOverlay.GetSlice())
|
||||
|
||||
updateStatus(node.Id.Get(), "RUNTIME_OVERLAY", node.RuntimeOverlay.Get(), strings.Split(req.RemoteAddr, ":")[0])
|
||||
|
||||
Reference in New Issue
Block a user