summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJannik Schönartz2019-10-23 16:39:45 +0200
committerJannik Schönartz2019-10-23 16:39:45 +0200
commit4303c553b9bb643ec1ee877ae816f87c244b2246 (patch)
tree84b998563290d0ee00b5c9f0ae7f32278b72b98c /server
parent[server/registration] Automatic registration now sets the hostname (dhcp) as ... (diff)
downloadbas-4303c553b9bb643ec1ee877ae816f87c244b2246.tar.gz
bas-4303c553b9bb643ec1ee877ae816f87c244b2246.tar.xz
bas-4303c553b9bb643ec1ee877ae816f87c244b2246.zip
[server/registration] Fix ipxe url bug and add delay before chaining
Ipxe can't handle url chains with a specific ports. Port forwarding has to be done on the server e.g. via haproxy 5s delay after adding a client to prevent the ipxe script from chaining to fast and booting the wrong config
Diffstat (limited to 'server')
-rw-r--r--server/api/registration.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/server/api/registration.js b/server/api/registration.js
index 548e82d..9064846 100644
--- a/server/api/registration.js
+++ b/server/api/registration.js
@@ -8,7 +8,8 @@ var db = require(path.join(__appdir, 'lib', 'sequelize'))
const backendHelper = require(path.join(__appdir, 'lib', 'external-backends', 'backendhelper'))
const ipHelper = require(path.join(__appdir, 'lib', 'iphelper'))
const config = require(path.join(__appdir, 'config', 'config'))
-const url = config.https.host + ':' + config.https.port
+// Ipxe needs the url without the port because ipxe can't handle port requests
+const url = config.https.host // + ':' + config.https.port
const log = require(path.join(__appdir, 'lib', 'log'))
// GET requests.
@@ -229,8 +230,8 @@ noAuthRouter.postAsync('/clients', async (req, res) => {
log({ category: 'REGISTRATION', description: 'Client added successfully.', clientId: newClient.id })
// Add the client to the backends.
- const result = await backendHelper.addClient(client)
- if (ipxe) return res.send(`#!ipxe\nchain https://` + url + `/api/configloader/\${uuid}`)
+ const result = backendHelper.addClient(client)
+ if (ipxe) return res.send(`#!ipxe\nsleep 5\nchain https://` + url + `/api/configloader/\${uuid}`)
else return res.send(result)
})