From d444b320dea07248dc69c81d0ce9ea5fc353e701 Mon Sep 17 00:00:00 2001 From: Alex Shatov Date: Thu, 21 Jun 2018 09:19:07 -0400 Subject: 3.0.1 policy-handler - cleaning sonar smells - no change of functionality or API - removed the unused enum34>=1.1.6 from requirements.txt and setup.py - refactored run_policy.sh to redirect the stdout+stderr only once - refactoring to remove smells+vulnerability reported by sonar -- renamed Config.config to Config.settings -- removed the commented out code in customizer.py -- renamed StepTimer.NEXT to StepTimer.STATE_NEXT to avoid the naming confusion with the method StepTimer.next. Also renamed the related StepTimer.STATE_* constants -- refactored several functions by extracting methods to eliminate 4 out of 5 "brain-overload" smells reported by sonar -- moved the literal string for the socket_host "0.0.0.0" to a constant on the web-server to avoid the reported vulnerability Change-Id: I4c7d47d41c6ecd7cb28f6704f5dad2053c1ca7d6 Signed-off-by: Alex Shatov Issue-ID: DCAEGEN2-515 --- policyhandler/web_server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'policyhandler/web_server.py') diff --git a/policyhandler/web_server.py b/policyhandler/web_server.py index 041a442..c49536f 100644 --- a/policyhandler/web_server.py +++ b/policyhandler/web_server.py @@ -30,13 +30,14 @@ from .policy_receiver import PolicyReceiver class PolicyWeb(object): """run REST API of policy-handler""" + SERVER_HOST = "0.0.0.0" logger = logging.getLogger("policy_handler.policy_web") @staticmethod def run_forever(audit): """run the web-server of the policy-handler forever""" PolicyWeb.logger.info("policy_handler web-service at port(%d)...", Config.wservice_port) - cherrypy.config.update({"server.socket_host": "0.0.0.0", + cherrypy.config.update({"server.socket_host": PolicyWeb.SERVER_HOST, 'server.socket_port': Config.wservice_port}) cherrypy.tree.mount(_PolicyWeb(), '/') audit.info("running policy_handler web-service at port({0})".format(Config.wservice_port)) -- cgit 1.2.3-korg