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

Ensure deleted core nodes are removed from config list

This commit is contained in:
Nick O'Leary 2015-02-04 10:27:02 +00:00
parent f462446213
commit 97621b41b9
2 changed files with 17 additions and 4 deletions

View File

@ -419,9 +419,22 @@ var registry = (function() {
var removed = false;
for (var mod in moduleConfigs) {
if (moduleConfigs.hasOwnProperty(mod)) {
if (moduleConfigs[mod] && !moduleNodes[mod]) {
var nodes = moduleConfigs[mod].nodes;
for (var node in nodes) {
var node;
if (mod == "node-red") {
// For core nodes, look for nodes that are enabled, !loaded and !errored
for (node in nodes) {
if (nodes.hasOwnProperty(node)) {
var n = nodes[node];
if (n.enabled && !n.err && !n.loaded) {
registry.removeNode(mod+"/"+node);
removed = true;
}
}
}
} else if (moduleConfigs[mod] && !moduleNodes[mod]) {
// For node modules, look for missing ones
for (node in nodes) {
if (nodes.hasOwnProperty(node)) {
registry.removeNode(mod+"/"+node);
removed = true;

View File

@ -81,7 +81,7 @@ function start() {
for (i in missingModules) {
if (missingModules.hasOwnProperty(i)) {
log.warn(" - "+i+": "+missingModules[i].join(", "));
if (settings.autoInstallModules) {
if (settings.autoInstallModules && i != "node-red") {
installModule(i).otherwise(function(err) {
// Error already reported. Need the otherwise handler
// to stop the error propagating any further