From 4303c553b9bb643ec1ee877ae816f87c244b2246 Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Wed, 23 Oct 2019 16:39:45 +0200 Subject: [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 --- server/api/registration.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'server/api') 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) }) -- cgit v1.2.3-55-g7522