summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannik Schönartz2021-04-06 18:58:33 +0200
committerJannik Schönartz2021-04-06 18:58:33 +0200
commit79bf0b07aeef65b7a1e1ed6dc58f450cb7e125ff (patch)
tree2bb2d7a533c9aec7152b1f9624d099646660d26a
parent[server/ipxe_builder] Update genereal.h (include vram settings) (diff)
downloadbas-79bf0b07aeef65b7a1e1ed6dc58f450cb7e125ff.tar.gz
bas-79bf0b07aeef65b7a1e1ed6dc58f450cb7e125ff.tar.xz
bas-79bf0b07aeef65b7a1e1ed6dc58f450cb7e125ff.zip
[server/registration] Fix error message when there is a fixed ip but no hostname
-rw-r--r--server/api/registration.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/server/api/registration.js b/server/api/registration.js
index a556bbe..fecc65c 100644
--- a/server/api/registration.js
+++ b/server/api/registration.js
@@ -298,7 +298,7 @@ noAuthRouter.postAsync('/clients', async (req, res) => {
// === Add 5 min to the time and round to the nearest one
const rounded = new Date(Math.round((date.getTime() + fiveMin) / tenMin) * tenMin)
- return res.send(buildNameClientIpxeMenu(client, `Client has a fixed IP but NO hostname was found. \nInfoblox might not be ready after client deletion. \nWait until ${rounded.toTimeString()} or enter a name and continue anyways ...`))
+ return res.send(buildNameClientIpxeMenu(client, ['Client has a fixed IP but NO hostname was found.', 'Infoblox might not be ready after client deletion.', `Wait until ${rounded.toTimeString()} or enter a name and continue anyways ...`]))
}
}
} else { // End of DHCP Stuff
@@ -770,8 +770,7 @@ function buildSelectIpIpxeMenu (client, ipList, error = undefined) {
let menuscript = ''
script += ':start\r\n'
script += 'menu Select the ip for this client: \r\n'
- for (let index in ipList) {
- const ip = ipList[index]
+ for (let ip of ipList) {
client.networks[0].dhcp = { ip: ip }
script += 'item ' + ip + ' ' + ip + '\r\n'
menuscript += ':' + ip + '\r\n' + 'params\r\nparam client ' + JSON.stringify(client) + '\r\n'
@@ -803,10 +802,14 @@ function buildSelectDomainIpxeMenu (client, domainList) {
return script
}
-function buildNameClientIpxeMenu (client, showError) {
+function buildNameClientIpxeMenu (client, showErrorLines) {
const basUrl = 'https://' + url
let script = '#!ipxe\r\n'
- if (showError) script += `echo ${showError}`
+
+ for (let line of showErrorLines) {
+ script += `echo ${line}\r\n`
+ }
+
script += '\r\necho Enter client name\r\nread clientname\r\nparams\r\n'
client.name = `\${clientname}`
script += 'param client ' + JSON.stringify(client) + '\r\n'