diff --git a/db.js b/db.js index 9d6c0f33..40f32379 100644 --- a/db.js +++ b/db.js @@ -726,19 +726,19 @@ module.exports.CreateDB = function (parent, func) { conn.release(); const docs = []; for (var i in rows) { if (rows[i].doc) { docs.push(performTypedRecordDecrypt(JSON.parse(rows[i].doc))); } } - if (func) try { func(null, docs); } catch (ex) { console.log(ex); } + if (func) try { func(null, docs); } catch (ex) { console.log('SQLERR1', ex); } }) - .catch(function (err) { conn.release(); if (func) try { func(err); } catch (ex) { console.log(ex); } }); - }).catch(function (err) { if (func) { try { func(err); } catch (ex) { console.log(ex); } } }); + .catch(function (err) { conn.release(); if (func) try { func(err); } catch (ex) { console.log('SQLERR2', ex); } }); + }).catch(function (err) { if (func) { try { func(err); } catch (ex) { console.log('SQLERR3', ex); } } }); } else if (obj.databaseType == 5) { // MySQL Datastore.query(query, args, function (error, results, fields) { if (error != null) { - if (func) try { func(error); } catch (ex) { console.log(ex); } + if (func) try { func(error); } catch (ex) { console.log('SQLERR4', ex); } } else { var docs = []; for (var i in results) { if (results[i].doc) { docs.push(JSON.parse(results[i].doc)); } } //console.log(docs); - if (func) { try { func(null, docs); } catch (ex) { console.log(ex); } } + if (func) { try { func(null, docs); } catch (ex) { console.log('SQLERR5', ex); } } } }); } diff --git a/meshagent.js b/meshagent.js index 04e97fe6..9efa434a 100644 --- a/meshagent.js +++ b/meshagent.js @@ -1125,12 +1125,15 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { } case 'smbios': { - // Store the RAW SMBios table of this computer - // Perform sanity checks before storing - try { - 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]; } } - db.SetSMBIOS({ _id: obj.dbNodeKey, domain: domain.id, time: new Date(), value: command.value }); - } catch (ex) { } + // See if we need to save SMBIOS information + if (domain.smbios !== false) { + // Store the RAW SMBios table of this computer + // Perform sanity checks before storing + try { + 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]; } } + db.SetSMBIOS({ _id: obj.dbNodeKey, domain: domain.id, time: new Date(), value: command.value }); + } catch (ex) { } + } // Event the node interface information change (This is a lot of traffic, probably don't need this). //parent.parent.DispatchEvent(parent.CreateMeshDispatchTargets(obj.meshid, [obj.dbNodeKey]), obj, { action: 'smBiosChange', nodeid: obj.dbNodeKey, domain: domain.id, smbios: command.value, nolog: 1 });