summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJannik Schönartz2019-06-07 17:10:24 +0200
committerJannik Schönartz2019-06-07 17:10:24 +0200
commit8f02dc7a012393e5046ca6e0686115df953aa00d (patch)
tree47707e37cc3f023a475b073927bfe2258b577c86 /server
parent[permissionmanager] remove console log and tab animation (diff)
downloadbas-8f02dc7a012393e5046ca6e0686115df953aa00d.tar.gz
bas-8f02dc7a012393e5046ca6e0686115df953aa00d.tar.xz
bas-8f02dc7a012393e5046ca6e0686115df953aa00d.zip
[external-backends/idoit] New idoit version -> bugfixes -> remove workarounds
Diffstat (limited to 'server')
-rw-r--r--server/lib/external-backends/backends/idoit-backend.js28
1 files changed, 13 insertions, 15 deletions
diff --git a/server/lib/external-backends/backends/idoit-backend.js b/server/lib/external-backends/backends/idoit-backend.js
index 160e7fe..95224fb 100644
--- a/server/lib/external-backends/backends/idoit-backend.js
+++ b/server/lib/external-backends/backends/idoit-backend.js
@@ -296,18 +296,24 @@ class IdoitBackend extends ExternalBackends {
// Add mac address: Network port is a subcategory of network so it need an extra request.
let macRequests = []
+ const hostnameIds = requestCreate[0].result.categories.C__CATG__IP
+
if (client.networks) {
for (let index in client.networks) {
const network = client.networks[index]
- // For the idresses
+ // For the ip adresses
// network.id = requestCreate[0].result.categories.C__CATG__IP[index]
+ let addresses = []
+ // Push the ids as string
+ if (hostnameIds.length >= index + 1) addresses.push('' + hostnameIds[index])
const paramsMac = {
'object': requestCreate[0].result.id,
'objID': requestCreate[0].result.id,
'category': 'C__CATG__NETWORK_PORT',
'data': {
- 'mac': network.mac
+ 'mac': network.mac,
+ 'addresses': addresses
},
'apikey': c.apikey
}
@@ -483,10 +489,7 @@ class IdoitBackend extends ExternalBackends {
}
counter++
- // WORKAROUND
- // bodies.push(this.getBody('cmdb.category.save', params, 'create_cpu_' + counter))
- const a = await this.axiosRequest(c.url, [this.getBody('cmdb.category.save', params, 'create_cpu_' + counter)], headers)
- requestResults.push(a)
+ bodies.push(this.getBody('cmdb.category.save', params, 'create_cpu_' + counter))
}
}
@@ -512,17 +515,15 @@ class IdoitBackend extends ExternalBackends {
'apikey': c.apikey
}
counter++
- // WORKAROUND
- // bodies.push(this.getBody('cmdb.category.save', params, 'create_memory_' + counter))
- const a = await this.axiosRequest(c.url, [this.getBody('cmdb.category.save', params, 'create_memory_' + counter)], headers)
- requestResults.push(a)
+ bodies.push(this.getBody('cmdb.category.save', params, 'create_memory_' + counter))
}
}
// Update the object. Drive data.
if (client.drives) {
let counter = 1
- for (let drive of client.drives) {
+ for (let index in client.drives) {
+ const drive = client.drives[index]
// UNIT
if (drive.unit === 'GB') drive.unit = 3
else if (drive.unit === 'MB') drive.unit = 2
@@ -553,11 +554,8 @@ class IdoitBackend extends ExternalBackends {
'apikey': c.apikey
}
+ bodies.push(this.getBody('cmdb.category.save', params, 'create_drive_' + counter))
counter++
- // WORKAROUND
- // bodies.push(this.getBody('cmdb.category.save', params, 'create_drive_' + counter))
- const a = await this.axiosRequest(c.url, [this.getBody('cmdb.category.save', params, 'create_drive_' + counter)], headers)
- requestResults.push(a)
}
}