From af20f3df647254aa58257052e56c53877357ab28 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 13 Mar 2015 13:15:20 +0000 Subject: [PATCH] Partial deploy with missing node type breaks deploy --- red/nodes/Flow.js | 56 +++++++++++++++++++++------------------------- red/nodes/flows.js | 40 +++++++++++++++++++++++++-------- 2 files changed, 56 insertions(+), 40 deletions(-) diff --git a/red/nodes/Flow.js b/red/nodes/Flow.js index c0fc09a6e..91fe5260b 100644 --- a/red/nodes/Flow.js +++ b/red/nodes/Flow.js @@ -253,6 +253,7 @@ function Flow(config) { this.activeNodes = {}; this.subflowInstanceNodes = {}; + this.catchNodeMap = {}; this.started = false; this.parseConfig(config); @@ -273,8 +274,6 @@ Flow.prototype.parseConfig = function(config) { this.configNodes = {}; - this.catchNodeMap = null; - var unknownTypes = {}; for (i=0;i 0) { throw new Error("missing types"); @@ -402,8 +410,14 @@ Flow.prototype.start = function() { events.emit("nodes-started"); } -Flow.prototype.stop = function(nodeList) { - nodeList = nodeList || Object.keys(this.activeNodes); +Flow.prototype.stop = function(configDiff) { + var nodeList; + + if (configDiff) { + nodeList = configDiff.stop; + } else { + nodeList = Object.keys(this.activeNodes); + } var flow = this; return when.promise(function(resolve) { events.emit("nodes-stopping"); @@ -481,15 +495,12 @@ Flow.prototype.applyConfig = function(config,type) { //} var nodesToStop = []; - var nodesToCreate = []; nodesToRewire = diff.wiringChanged; if (type == "nodes") { nodesToStop = diff.deleted.concat(diff.changed); - nodesToCreate = diff.changed; } else if (type == "flows") { nodesToStop = diff.deleted.concat(diff.changed).concat(diff.linked); - nodesToCreate = diff.changed.concat(diff.linked); } for (var i=0;i 0) { @@ -140,11 +154,19 @@ var flowNodes = module.exports = { } } }, - stopFlows: function() { - log.info("Stopping flows"); + stopFlows: function(configDiff) { + if (configDiff) { + log.info("Stopping modified "+configDiff.type); + } else { + log.info("Stopping flows"); + } if (activeFlow) { - return activeFlow.stop().then(function() { - log.info("Stopped flows"); + return activeFlow.stop(configDiff).then(function() { + if (configDiff) { + log.info("Stopped modified "+configDiff.type); + } else { + log.info("Stopped flows"); + } return; }); } else {