summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/api/registration.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/server/api/registration.js b/server/api/registration.js
index fd8b808..8487577 100644
--- a/server/api/registration.js
+++ b/server/api/registration.js
@@ -194,6 +194,13 @@ noAuthRouter.postAsync('/clients', async (req, res) => {
if (req.body.version && req.body.version >= 2) {
/* New hardware collection script */
client = await parseHardwareInformation(req.body)
+
+ // If the client already exists return the configloader ipxe script.
+ const clientDb = await db.client.findOne({ where: { uuid: client.uuid } })
+ if (clientDb) {
+ if (ipxe) return res.send(`#!ipxe\nchain https://` + url + `/api/configloader/\${uuid}`)
+ else return res.send({ error: 'CLIENT_ALREADY_EXISTS', msg: 'A client with the provided UUID does already exist.' })
+ }
} else {
client = req.body.client
if (typeof client === 'string') client = JSON.parse(client)