using ProvisionSend instean of GrubSend
Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
committed by
Jonathon Anderson
parent
60dc8f6251
commit
0c9bf78cd0
@@ -5,6 +5,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@@ -16,6 +17,7 @@ type parserInfo struct {
|
||||
uuid string
|
||||
stage string
|
||||
overlay string
|
||||
efifile string
|
||||
compress string
|
||||
}
|
||||
|
||||
@@ -25,16 +27,22 @@ func parseReq(req *http.Request) (parserInfo, error) {
|
||||
url := strings.Split(req.URL.Path, "?")[0]
|
||||
path_parts := strings.Split(url, "/")
|
||||
|
||||
if len(path_parts) != 3 {
|
||||
if len(path_parts) < 3 {
|
||||
return ret, errors.New("unknown path components in GET")
|
||||
}
|
||||
|
||||
// handle when stage was passed in the url path /[stage]/hwaddr
|
||||
stage := path_parts[1]
|
||||
hwaddr := path_parts[2]
|
||||
hwaddr = strings.ReplaceAll(hwaddr, "-", ":")
|
||||
hwaddr = strings.ToLower(hwaddr)
|
||||
|
||||
hwaddr := ""
|
||||
if stage != "efiboot" {
|
||||
hwaddr = path_parts[2]
|
||||
hwaddr = strings.ReplaceAll(hwaddr, "-", ":")
|
||||
hwaddr = strings.ToLower(hwaddr)
|
||||
} else if len(path_parts) > 3 {
|
||||
ret.efifile = strings.Join(path_parts[2:], "/")
|
||||
} else {
|
||||
ret.efifile = path_parts[2]
|
||||
}
|
||||
ret.hwaddr = hwaddr
|
||||
ret.ipaddr = strings.Split(req.RemoteAddr, ":")[0]
|
||||
ret.remoteport, _ = strconv.Atoi(strings.Split(req.RemoteAddr, ":")[1])
|
||||
@@ -63,6 +71,8 @@ func parseReq(req *http.Request) (parserInfo, error) {
|
||||
ret.stage = "system"
|
||||
} else if stage == "overlay-runtime" {
|
||||
ret.stage = "runtime"
|
||||
} else if stage == "efiboot" {
|
||||
ret.stage = "efiboot"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +86,11 @@ func parseReq(req *http.Request) (parserInfo, error) {
|
||||
return ret, errors.New("no stage encoded in GET")
|
||||
}
|
||||
if ret.hwaddr == "" {
|
||||
return ret, errors.New("no hwaddr encoded in GET")
|
||||
ret.hwaddr = ArpFind(ret.ipaddr)
|
||||
wwlog.Verbose("node mac encoded, arp cache got %s for %s", ret.hwaddr, ret.ipaddr)
|
||||
if ret.hwaddr == "" {
|
||||
return ret, errors.New("no hwaddr encoded in GET")
|
||||
}
|
||||
}
|
||||
if ret.ipaddr == "" {
|
||||
return ret, errors.New("could not obtain ipaddr from HTTP request")
|
||||
|
||||
Reference in New Issue
Block a user