From fc41b7e8b71aae32b11cd05d056d6469a7488950 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Wed, 9 Sep 2020 14:26:03 -0700 Subject: [PATCH] Fixed device remove exception. --- meshagent.js | 16 ++++++++-------- meshuser.js | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/meshagent.js b/meshagent.js index c597dd00..fac05f5a 100644 --- a/meshagent.js +++ b/meshagent.js @@ -63,14 +63,14 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { // If this is a temporary or recovery agent, or all devices in this group are temporary, remove the agent (0x20 = Temporary, 0x40 = Recovery) if (((obj.agentInfo) && (obj.agentInfo.capabilities) && ((obj.agentInfo.capabilities & 0x20) || (obj.agentInfo.capabilities & 0x40))) || ((mesh) && (mesh.flags) && (mesh.flags & 1))) { // Delete this node including network interface information and events - db.Remove(obj.dbNodeKey); // Remove node with that id - db.Remove('if' + obj.dbNodeKey); // Remove interface information - db.Remove('nt' + obj.dbNodeKey); // Remove notes - db.Remove('lc' + obj.dbNodeKey); // Remove last connect time - db.Remove('si' + obj.dbNodeKey); // Remove system information - db.RemoveSMBIOS(obj.dbNodeKey); // Remove SMBios data - db.RemoveAllNodeEvents(obj.dbNodeKey); // Remove all events for this node - db.removeAllPowerEventsForNode(obj.dbNodeKey); // Remove all power events for this node + db.Remove(obj.dbNodeKey); // Remove node with that id + db.Remove('if' + obj.dbNodeKey); // Remove interface information + db.Remove('nt' + obj.dbNodeKey); // Remove notes + db.Remove('lc' + obj.dbNodeKey); // Remove last connect time + db.Remove('si' + obj.dbNodeKey); // Remove system information + if (db.RemoveSMBIOS) { db.RemoveSMBIOS(obj.dbNodeKey); } // Remove SMBios data + db.RemoveAllNodeEvents(obj.dbNodeKey); // Remove all events for this node + db.removeAllPowerEventsForNode(obj.dbNodeKey); // Remove all power events for this node // Event node deletion parent.parent.DispatchEvent(parent.CreateMeshDispatchTargets(obj.dbMeshKey, [obj.dbNodeKey]), obj, { etype: 'node', action: 'removenode', nodeid: obj.dbNodeKey, domain: domain.id, nolog: 1 }); diff --git a/meshuser.js b/meshuser.js index 564b8faa..0cf4a188 100644 --- a/meshuser.js +++ b/meshuser.js @@ -3419,14 +3419,14 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if ((rights & MESHRIGHT_UNINSTALL) == 0) return; // Delete this node including network interface information, events and timeline - db.Remove(node._id); // Remove node with that id - db.Remove('if' + node._id); // Remove interface information - db.Remove('nt' + node._id); // Remove notes - db.Remove('lc' + node._id); // Remove last connect time - db.Remove('si' + node._id); // Remove system information - db.RemoveSMBIOS(node._id); // Remove SMBios data - db.RemoveAllNodeEvents(node._id); // Remove all events for this node - db.removeAllPowerEventsForNode(node._id); // Remove all power events for this node + db.Remove(node._id); // Remove node with that id + db.Remove('if' + node._id); // Remove interface information + db.Remove('nt' + node._id); // Remove notes + db.Remove('lc' + node._id); // Remove last connect time + db.Remove('si' + node._id); // Remove system information + if (db.RemoveSMBIOS) { db.RemoveSMBIOS(node._id); } // Remove SMBios data + db.RemoveAllNodeEvents(node._id); // Remove all events for this node + db.removeAllPowerEventsForNode(node._id); // Remove all power events for this node db.Get('ra' + obj.dbNodeKey, function (err, nodes) { if ((nodes != null) && (nodes.length == 1)) { db.Remove('da' + nodes[0].daid); } // Remove diagnostic agent to real agent link db.Remove('ra' + node._id); // Remove real agent to diagnostic agent link