summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannik Schönartz2019-04-14 06:13:59 +0200
committerJannik Schönartz2019-04-14 06:13:59 +0200
commita4fe27200df3181a5b9dee4eef1bb4f0f4f2d028 (patch)
tree0d68b0f89851dab443250cbbd11b4e0fd06ec846
parent[server/registration] Set hostname as client name for clients with a fixed ip (diff)
downloadbas-a4fe27200df3181a5b9dee4eef1bb4f0f4f2d028.tar.gz
bas-a4fe27200df3181a5b9dee4eef1bb4f0f4f2d028.tar.xz
bas-a4fe27200df3181a5b9dee4eef1bb4f0f4f2d028.zip
[server/registration] Bugfix: DHCP mapping was not correctly created if the dhcp record already existed.
-rw-r--r--server/api/registration.js5
-rw-r--r--server/lib/external-backends/backends/infoblox-backend.js2
2 files changed, 5 insertions, 2 deletions
diff --git a/server/api/registration.js b/server/api/registration.js
index ff0652b..207413c 100644
--- a/server/api/registration.js
+++ b/server/api/registration.js
@@ -184,7 +184,10 @@ noAuthRouter.postAsync('/clients', async (req, res) => {
else if (!ipxe && ipCheck.leased && !ipCheck.error) return res.send({ client: client, ipList: ipCheck.nextIps })
// Set the hostname as clientname if it exists and is not a leased ip.
- if (!ipCheck.leased && ipCheck.name) client.name = ipCheck.name
+ if (!ipCheck.leased) {
+ if (ipCheck.name) client.name = ipCheck.name
+ if (ipCheck.id) dhcp.ref = ipCheck.id
+ }
}
}
}
diff --git a/server/lib/external-backends/backends/infoblox-backend.js b/server/lib/external-backends/backends/infoblox-backend.js
index e9a8fee..74f0265 100644
--- a/server/lib/external-backends/backends/infoblox-backend.js
+++ b/server/lib/external-backends/backends/infoblox-backend.js
@@ -84,7 +84,7 @@ class InfobloxBackend extends ExternalBackends {
return { leased: true, nextIps: nextIps }
}
- let response = { leased: false }
+ let response = { leased: false, id: host._ref }
if (host.names.length >= 1) response.name = host.names[0].split('.')[0]
return response
}