aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAlex Shatov <alexs@att.com>2018-02-22 15:37:07 -0500
committerAlex Shatov <alexs@att.com>2018-02-22 15:37:07 -0500
commit556928ec47610a82ffcede0e3d350c47e692ba14 (patch)
treec443fefbf2c637ba4370bb84958b654e0e82400c /lib
parent66215a25d592c76d9babfc480c80c74e561f5126 (diff)
reduce messaging when deployment not busy
- reduce the messaging when the deployment is not busy in cloudify - returned checking the version and existence when the deployment not busy - otherwise just send all data to plugin in cloudify - bumped up pom version to 2.0.1 Change-Id: I8520de58f4e344bac9f32e21ddcfed7d4ebb205b Signed-off-by: Alex Shatov <alexs@att.com> Issue-ID: DCAEGEN2-356
Diffstat (limited to 'lib')
-rw-r--r--lib/cloudify.js3
-rw-r--r--lib/policy.js14
2 files changed, 10 insertions, 7 deletions
diff --git a/lib/cloudify.js b/lib/cloudify.js
index e6f1753..0dbb876 100644
--- a/lib/cloudify.js
+++ b/lib/cloudify.js
@@ -64,7 +64,8 @@ ExeQueue.prototype.nextExecution = function(deployment_id) {
}
return depl.exe_queue[0];
};
-var exeQueue = new ExeQueue();
+const exeQueue = new ExeQueue();
+exports.exeQueue = exeQueue;
// Delay function--returns a promise that's resolved after 'dtime'
// milliseconds.`
diff --git a/lib/policy.js b/lib/policy.js
index 4bc40fe..305500b 100644
--- a/lib/policy.js
+++ b/lib/policy.js
@@ -99,7 +99,8 @@ function policyUpdate(req, res, next) {
"updated_policies": {},
"added_policies": {},
"removed_policy_ids": {},
- "node_instance_ids": []
+ "node_instance_ids": [],
+ "is_deployment_busy": cloudify.exeQueue.isDeploymentBusy(node_instance.deployment_id)
};
var have_policies = false;
@@ -110,6 +111,7 @@ function policyUpdate(req, res, next) {
const latest_policy = policy_update.latest_policies[policy_id];
if (policy_update.removed_policies[policy_id]
|| (policy_update.catch_up
+ && (deployed_policy.policy_body || deployment.is_deployment_busy)
&& !latest_policy
&& !policy_update.errored_policies[policy_id]
&& !is_policy_in_errored_scopes(policy_id)
@@ -123,10 +125,10 @@ function policyUpdate(req, res, next) {
if (!latest_policy || !latest_policy.policy_body
|| isNaN(latest_policy.policy_body.policyVersion)) {return;}
- // || latest_policy.policy_body.policyVersion
- // === (deployed_policy.policy_body && deployed_policy.policy_body.policyVersion)) {
- // return;
- // }
+
+ if (!deployment.is_deployment_busy && latest_policy.policy_body.policyVersion
+ === (deployed_policy.policy_body && deployed_policy.policy_body.policyVersion)) {return;}
+
have_policies = true;
deployment.updated_policies[policy_id] = latest_policy;
policy_update.updated_policy_ids[policy_id] = true;
@@ -139,7 +141,7 @@ function policyUpdate(req, res, next) {
logger.debug(req.dcaeReqId, "matching latest policies to policy_filters[" + policy_filter_ids.length + "] on node_instance: " + JSON.stringify(node_instance));
try {
Object.keys(policy_update.latest_policies).forEach(policy_id => {
- // if (deployment.updated_policies[policy_id] || deployed_policies[policy_id]) {return;}
+ if (!deployment.is_deployment_busy && deployed_policies[policy_id]) {return;}
const latest_policy = policy_update.latest_policies[policy_id];
const policy_body = latest_policy && latest_policy.policy_body;