1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Use module:node name to generate set id

This commit is contained in:
Nick O'Leary 2014-09-22 13:15:19 +01:00
parent c98b9dfaa3
commit 9bfc6d376b
2 changed files with 16 additions and 2 deletions

View File

@ -419,7 +419,18 @@ function loadNodesFromModule(moduleDir,pkg) {
*/
function loadNodeConfig(file,module,name) {
var id = crypto.createHash('sha1').update(file).digest("hex");
if (module && name) {
var newid = crypto.createHash('sha1').update(module+":"+name).digest("hex");
var existingInfo = registry.getNodeInfo(id);
if (existingInfo) {
// For a brief period, id for modules were calculated incorrectly.
// To prevent false-duplicates, this removes the old id entry
registry.removeNode(id);
registry.saveNodeList();
}
id = newid;
}
var info = registry.getNodeInfo(id);
var isEnabled = true;

View File

@ -242,7 +242,7 @@ function installModule(module) {
if (err) {
var lookFor404 = new RegExp(" 404 .*"+module+"$","m");
if (lookFor404.test(stdout)) {
util.log("[red] Installation of module "+module+" failed: not found");
util.log("[red] Installation of module "+module+" failed: module not found");
var e = new Error();
e.code = 404;
reject(e);
@ -324,7 +324,10 @@ function start() {
for (i in missingModules) {
if (missingModules.hasOwnProperty(i)) {
util.log(" - "+i+": "+missingModules[i].join(", "));
promises.push(installModule(i));
installModule(i).otherwise(function(err) {
// Error already reported. Need the otherwise handler
// to stop the error propagating any further
});
}
}