diff options
author | Alex Shatov <alexs@att.com> | 2018-02-01 14:16:56 -0500 |
---|---|---|
committer | Alex Shatov <alexs@att.com> | 2018-02-01 14:16:56 -0500 |
commit | ac779d374ca12099eaeb8e5d89e65df37fd8a8f4 (patch) | |
tree | 181e0b72ead781dcab526124c81096980a552e8b /policyhandler/web_server.py | |
parent | 2322ef8736e839d62930d9b6c847ce818261c26c (diff) |
improved message to deployment-handler and on API
* added errored_scopes and scope_prefixes to the message
to deployment-handler - to prevent erroneous
removal of policies
* hardcoded condition for scope not found 404 at policy-engine
to separate it from error on the scope retrieval 400
* adjusting the web API message in sync with notification
to deployment-handler
* unit test coverage 74%
Change-Id: Ie736a1b7aee0631b6785669c6b765bd240dd77b8
Issue-ID: DCAEGEN2-249
Signed-off-by: Alex Shatov <alexs@att.com>
Diffstat (limited to 'policyhandler/web_server.py')
-rw-r--r-- | policyhandler/web_server.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/policyhandler/web_server.py b/policyhandler/web_server.py index 5b3227d..17c06b4 100644 --- a/policyhandler/web_server.py +++ b/policyhandler/web_server.py @@ -79,16 +79,15 @@ class _PolicyWeb(object): PolicyWeb.logger.info("%s", req_info) - valid_policies, errored_policies = PolicyRest.get_latest_policies(audit) + result = PolicyRest.get_latest_policies(audit) - res = {"valid_policies": valid_policies, "errored_policies": errored_policies} - PolicyWeb.logger.info("result %s: %s", req_info, json.dumps(res)) + PolicyWeb.logger.info("result %s: %s", req_info, json.dumps(result)) - success, http_status_code, _ = audit.audit_done(result=json.dumps(res)) + success, http_status_code, _ = audit.audit_done(result=json.dumps(result)) if not success: cherrypy.response.status = http_status_code - return res + return result @cherrypy.expose @cherrypy.tools.json_out() @@ -153,16 +152,16 @@ class _PolicyWeb(object): PolicyWeb.logger.info("%s: policy_filter=%s headers=%s", \ req_info, str_policy_filter, json.dumps(cherrypy.request.headers)) - res, _ = PolicyRest.get_latest_policies(audit, policy_filter=policy_filter) or {} + result = PolicyRest.get_latest_policies(audit, policy_filter=policy_filter) or {} - PolicyWeb.logger.info("result %s: policy_filter=%s res=%s", \ - req_info, str_policy_filter, json.dumps(res)) + PolicyWeb.logger.info("result %s: policy_filter=%s result=%s", \ + req_info, str_policy_filter, json.dumps(result)) - success, http_status_code, _ = audit.audit_done(result=json.dumps(res)) + success, http_status_code, _ = audit.audit_done(result=json.dumps(result)) if not success: cherrypy.response.status = http_status_code - return res + return result @cherrypy.expose @cherrypy.tools.json_out() |