Added way to not save SMBIOS information in the DB.
Ylian Saint-Hilaire committed
Apr 24, 2020 at 13:37 UTC
7653d1c398ecfc7378f450ab495a2adf27b54e3d
2 files changed
+14
-11
db.js
+5
-5
@@ -726,19 +726,19 @@ module.exports.CreateDB = function (parent, func) {
726
conn.release();
727
const docs = [];
728
for (var i in rows) { if (rows[i].doc) { docs.push(performTypedRecordDecrypt(JSON.parse(rows[i].doc))); } }
729
- if (func) try { func(null, docs); } catch (ex) { console.log(ex); }
729
+ if (func) try { func(null, docs); } catch (ex) { console.log('SQLERR1', ex); }
730
})
731
- .catch(function (err) { conn.release(); if (func) try { func(err); } catch (ex) { console.log(ex); } });
732
- }).catch(function (err) { if (func) { try { func(err); } catch (ex) { console.log(ex); } } });
731
+ .catch(function (err) { conn.release(); if (func) try { func(err); } catch (ex) { console.log('SQLERR2', ex); } });
732
+ }).catch(function (err) { if (func) { try { func(err); } catch (ex) { console.log('SQLERR3', ex); } } });
733
} else if (obj.databaseType == 5) { // MySQL
734
Datastore.query(query, args, function (error, results, fields) {
735
if (error != null) {
736
- if (func) try { func(error); } catch (ex) { console.log(ex); }
736
+ if (func) try { func(error); } catch (ex) { console.log('SQLERR4', ex); }
737
} else {
738
var docs = [];
739
for (var i in results) { if (results[i].doc) { docs.push(JSON.parse(results[i].doc)); } }
740
//console.log(docs);
741
- if (func) { try { func(null, docs); } catch (ex) { console.log(ex); } }
741
+ if (func) { try { func(null, docs); } catch (ex) { console.log('SQLERR5', ex); } }
742
}
743
});
744
}
meshagent.js
+9
-6
@@ -1125,12 +1125,15 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
1125
}
1126
case 'smbios':
1127
{
1128
- // Store the RAW SMBios table of this computer
1129
- // Perform sanity checks before storing
1130
- try {
1131
- for (var i in command.value) { var k = parseInt(i); if ((k != i) || (i > 255) || (typeof command.value[i] != 'object') || (command.value[i].length == null) || (command.value[i].length > 1024) || (command.value[i].length < 0)) { delete command.value[i]; } }
1132
- db.SetSMBIOS({ _id: obj.dbNodeKey, domain: domain.id, time: new Date(), value: command.value });
1133
- } catch (ex) { }
1128
+ // See if we need to save SMBIOS information
1129
+ if (domain.smbios !== false) {
1130
+ // Store the RAW SMBios table of this computer
1131
+ // Perform sanity checks before storing
1132
+ try {
1133
+ for (var i in command.value) { var k = parseInt(i); if ((k != i) || (i > 255) || (typeof command.value[i] != 'object') || (command.value[i].length == null) || (command.value[i].length > 1024) || (command.value[i].length < 0)) { delete command.value[i]; } }
1134
+ db.SetSMBIOS({ _id: obj.dbNodeKey, domain: domain.id, time: new Date(), value: command.value });
1135
+ } catch (ex) { }
1136
+ }
1137
1138
// Event the node interface information change (This is a lot of traffic, probably don't need this).
1139
//parent.parent.DispatchEvent(parent.CreateMeshDispatchTargets(obj.meshid, [obj.dbNodeKey]), obj, { action: 'smBiosChange', nodeid: obj.dbNodeKey, domain: domain.id, smbios: command.value, nolog: 1 });