created kernel.FindKernel reduces code complexity

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2024-03-21 16:21:06 +01:00
committed by Jonathon Anderson
parent b192e3b5d5
commit 2ba9efa57c
6 changed files with 45 additions and 105 deletions

View File

@@ -108,10 +108,9 @@ func ProvisionSend(w http.ResponseWriter, req *http.Request) {
if node.Kernel.Override.Defined() {
stage_file = kernel.KernelImage(node.Kernel.Override.Get())
} else if node.ContainerName.Defined() {
stage_file = container.KernelFind(node.ContainerName.Get())
if stage_file == "" {
wwlog.Error("No kernel found for container %s", node.ContainerName.Get())
stage_file, _, err = kernel.FindKernel(container.RootFsDir(node.ContainerName.Get()))
if err != nil {
wwlog.Error("No kernel found for container %s: %s", node.ContainerName.Get(), err)
}
} else {
wwlog.Warn("No kernel version set for node %s", node.Id.Get())