From 556928ec47610a82ffcede0e3d350c47e692ba14 Mon Sep 17 00:00:00 2001 From: Alex Shatov Date: Thu, 22 Feb 2018 15:37:07 -0500 Subject: 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 Issue-ID: DCAEGEN2-356 --- lib/cloudify.js | 3 ++- lib/policy.js | 14 ++++++++------ package.json | 2 +- pom.xml | 2 +- version.properties | 2 +- 5 files changed, 13 insertions(+), 10 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; diff --git a/package.json b/package.json index 5308cf5..d7d20e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "onap-dcae-deployment-handler", - "version": "4.3.0", + "version": "4.3.1", "description": "ONAP DCAE Deployment Handler", "main": "deployment-handler.js", "dependencies": { diff --git a/pom.xml b/pom.xml index 0da2313..23de193 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. org.onap.dcaegen2.platform deployment-handler dcaegen2-platform-deployment-handler - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT http://maven.apache.org UTF-8 diff --git a/version.properties b/version.properties index fbd1b27..ee9f646 100644 --- a/version.properties +++ b/version.properties @@ -1,6 +1,6 @@ major=2 minor=0 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT -- cgit 1.2.3-korg