From a7ff87f904d8f44d91116d991c57d56d4c8c2da6 Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Wed, 16 Feb 2022 20:59:46 +0100 Subject: [server/backends/idoit] 0 as bay was seen as undefined, rackunits fallback to 2 --- server/lib/external-backends/backends/idoit-backend.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/lib/external-backends/backends/idoit-backend.js b/server/lib/external-backends/backends/idoit-backend.js index 9632aa8..32d216d 100644 --- a/server/lib/external-backends/backends/idoit-backend.js +++ b/server/lib/external-backends/backends/idoit-backend.js @@ -796,7 +796,7 @@ class IdoitBackend extends ExternalBackends { */ // Update the object location. - if (client.parentId && (!client.location || (client.location && !client.location.bay))) { + if (client.parentId && (!client.location || (client.location && isNaN(client.location.bay)))) { // Either client or no slot was set let locationData = { 'parent': client.parentId @@ -817,7 +817,7 @@ class IdoitBackend extends ExternalBackends { // Create segments and prepare bay // Rack segmentation - if (!!client.location && !!client.location.slot && !!client.location.bay) { + if (!!client.location && !!client.location.slot && !isNaN(client.location.bay)) { // Get the parentId if none was given if (!client.parentId) { let boundedLocation = boundObjects.filter(response => response.id.startsWith('READ_C__CATG__LOCATION')) @@ -1025,7 +1025,9 @@ class IdoitBackend extends ExternalBackends { 'object': chassisId, 'objID': chassisId, 'category': 'C__CATG__FORMFACTOR', - 'data': { 'rackunits': client.formfactor.rackunits } + 'data': { + 'rackunits': client.formfactor ? client.formfactor.rackunits : 2 + } }, 'set_segment_size') await this.axiosRequest(credentials.url, [setSegmentSizeParams], headers) -- cgit v1.2.3-55-g7522