aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Shatov <alexs@att.com>2018-02-23 14:11:57 -0500
committerAlex Shatov <alexs@att.com>2018-02-23 14:11:57 -0500
commit5035caeacb65e7d871730beca04877c37d1f76f8 (patch)
treecdef9fbcec3dc179cfbb1cbacce2d30891026fb7
parent556928ec47610a82ffcede0e3d350c47e692ba14 (diff)
fixed bug=crashing on /policy/components
Change-Id: I9f7e7e6448f31cdabb0dd029e05aaab134148356 Signed-off-by: Alex Shatov <alexs@att.com> Issue-ID: DCAEGEN2-356
-rw-r--r--lib/policy.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/policy.js b/lib/policy.js
index 305500b..b91e5fd 100644
--- a/lib/policy.js
+++ b/lib/policy.js
@@ -274,7 +274,7 @@ function policyUpdate(req, res, next) {
*/
function getComponentPoliciesFromCloudify(req, res, next) {
logger.debug(req.dcaeReqId, "getComponentPoliciesFromCloudify " + req.originalUrl);
- var response = {"requestId": req.dcaeReqId};
+ const response = {"requestId": req.dcaeReqId};
response.started = new Date();
response.node_instance_ids = [];
response.component_policies = [];
@@ -295,7 +295,7 @@ function getComponentPoliciesFromCloudify(req, res, next) {
if (node_instance.runtime_properties.policies) {
Object.keys(node_instance.runtime_properties.policies).forEach(policy_id => {
++policies_count;
- var policy = node_instance.runtime_properties.policies[policy_id];
+ const policy = node_instance.runtime_properties.policies[policy_id];
policy.component_id = node_instance.id;
policy.deployment_id = node_instance.deployment_id;
response.component_policies.push(policy);
@@ -305,14 +305,15 @@ function getComponentPoliciesFromCloudify(req, res, next) {
Object.keys(node_instance.runtime_properties.policy_filters).forEach(policy_filter => {
++policy_filters_count;
policy_filter = node_instance.runtime_properties.policy_filters[policy_filter];
- policy.component_id = node_instance.id;
- policy.deployment_id = node_instance.deployment_id;
+ policy_filter.component_id = node_instance.id;
+ policy_filter.deployment_id = node_instance.deployment_id;
response.component_policy_filters.push(policy_filter);
});
}
if (policies_count + policy_filters_count) {
response.node_instance_ids.push({
"node_instance_id" : node_instance.id,
+ "deployment_id" : node_instance.deployment_id,
"policies_count" : policies_count,
"policy_filters_count" : policy_filters_count
});