summaryrefslogtreecommitdiffstats
path: root/server/lib/external-backends
diff options
context:
space:
mode:
authorJannik Schönartz2019-04-14 05:41:48 +0200
committerJannik Schönartz2019-04-14 05:41:48 +0200
commit9c7488e58053294bbc69fb12addd083d7c7ffbfa (patch)
treece682390e649cfd31f58c44968c3d21af22fe27f /server/lib/external-backends
parent[webapp/groups] fix tabslider incorrect length when tab name changes (diff)
downloadbas-9c7488e58053294bbc69fb12addd083d7c7ffbfa.tar.gz
bas-9c7488e58053294bbc69fb12addd083d7c7ffbfa.tar.xz
bas-9c7488e58053294bbc69fb12addd083d7c7ffbfa.zip
[server/registration] Set hostname as client name for clients with a fixed ip
Diffstat (limited to 'server/lib/external-backends')
-rw-r--r--server/lib/external-backends/backends/infoblox-backend.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/lib/external-backends/backends/infoblox-backend.js b/server/lib/external-backends/backends/infoblox-backend.js
index 2671491..e9a8fee 100644
--- a/server/lib/external-backends/backends/infoblox-backend.js
+++ b/server/lib/external-backends/backends/infoblox-backend.js
@@ -73,7 +73,7 @@ class InfobloxBackend extends ExternalBackends {
apiVersion: c.version
})
const login = await ipam.login(c.username, c.password)
- if (!login) return false
+ if (!login) return { leased: false }
// Get the host and check the leased state
let host = JSON.parse(await ipam.getHost(ipv4))[0]
@@ -81,9 +81,12 @@ class InfobloxBackend extends ExternalBackends {
// If leased return the next 20 free ips of the subnet.
const dhcpNetwork = JSON.parse(await ipam.getNetworkFromIp(ipv4))
const nextIps = await ipam.getNext(dhcpNetwork[0]._ref, 20)
- return nextIps
+ return { leased: true, nextIps: nextIps }
}
- return false
+
+ let response = { leased: false }
+ if (host.names.length >= 1) response.name = host.names[0].split('.')[0]
+ return response
}
async setIp (credentials, ipv4, mac, name, setNextIp = false) {