summaryrefslogtreecommitdiffstats
path: root/server/api
diff options
context:
space:
mode:
authorJannik Schönartz2019-11-27 11:09:43 +0100
committerJannik Schönartz2019-11-27 11:09:43 +0100
commitfeafcbfe00ead360140d38a9dd2c03da2204b1dc (patch)
tree100d74a8a9d4cf64219319a5e9446f2ba0c800fe /server/api
parent[server/configloader] Add a better (dynamic) default config, delete the old d... (diff)
downloadbas-feafcbfe00ead360140d38a9dd2c03da2204b1dc.tar.gz
bas-feafcbfe00ead360140d38a9dd2c03da2204b1dc.tar.xz
bas-feafcbfe00ead360140d38a9dd2c03da2204b1dc.zip
[server/external-backends/infoblox] Add infoblox fix for a client registration in a network where the bas has no permission
Diffstat (limited to 'server/api')
-rw-r--r--server/api/registration.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/api/registration.js b/server/api/registration.js
index 156ec21..202d836 100644
--- a/server/api/registration.js
+++ b/server/api/registration.js
@@ -152,15 +152,15 @@ noAuthRouter.postAsync('/clients', async (req, res) => {
const ipCheck = await dhcp.instance.checkIp(dhcp.backend.credentials, network.ip)
// If it's not leased, set the hostname as clientname
- if (!ipCheck.leased && ipCheck.name !== '') {
+ if (!ipCheck.error && !ipCheck.leased && ipCheck.name !== '') {
if (ipCheck.name) client.name = ipCheck.name
if (ipCheck.id) dhcp.ref = ipCheck.id
} else {
client.name = client.type + '_' + client.uuid
const setIp = await dhcp.instance.setIp(dhcp.backend.credentials, network.ip, network.mac, undefined, true)
- dhcp.ref = setIp.ref
// Check for errors.
if (!setIp.error) {
+ dhcp.ref = setIp.ref
// Client ip set successfully
client.networks[0].ip = setIp.ip
} else {
@@ -222,7 +222,7 @@ noAuthRouter.postAsync('/clients', async (req, res) => {
client.id = newClient.id
// Add dhcp backend mapping
- if (dhcp) dhcp.backend.addMappedClients(newClient, { through: { externalId: dhcp.ref } })
+ if (dhcp && dhcp.ref) dhcp.backend.addMappedClients(newClient, { through: { externalId: dhcp.ref } })
// Add groups to the client.
if (client.parents.length === 0) client.parents = await ipHelper.getGroups(client.networks[0].ip)