From 5035caeacb65e7d871730beca04877c37d1f76f8 Mon Sep 17 00:00:00 2001 From: Alex Shatov Date: Fri, 23 Feb 2018 14:11:57 -0500 Subject: fixed bug=crashing on /policy/components Change-Id: I9f7e7e6448f31cdabb0dd029e05aaab134148356 Signed-off-by: Alex Shatov Issue-ID: DCAEGEN2-356 --- lib/policy.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/policy.js') 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 }); -- cgit 1.2.3-korg