diff options
Diffstat (limited to 'moon_authz')
-rw-r--r-- | moon_authz/moon_authz/api/authorization.py | 2 | ||||
-rw-r--r-- | moon_authz/moon_authz/server.py | 17 |
2 files changed, 11 insertions, 8 deletions
diff --git a/moon_authz/moon_authz/api/authorization.py b/moon_authz/moon_authz/api/authorization.py index c83dd72c..ea177d81 100644 --- a/moon_authz/moon_authz/api/authorization.py +++ b/moon_authz/moon_authz/api/authorization.py @@ -73,7 +73,7 @@ class Authz(Resource): return response def run(self): - logger.info("self.context.pdp_set={}".format(self.context.pdp_set)) + logger.debug("self.context.pdp_set={}".format(self.context.pdp_set)) result, message = self.__check_rules() if result: return self.__exec_instructions(result) diff --git a/moon_authz/moon_authz/server.py b/moon_authz/moon_authz/server.py index 8715bd87..0cc5f6fc 100644 --- a/moon_authz/moon_authz/server.py +++ b/moon_authz/moon_authz/server.py @@ -6,7 +6,7 @@ import os import logging from moon_authz.http_server import HTTPServer as Server -from python_moonutilities import configuration +from python_moonutilities import configuration, exceptions logger = logging.getLogger("moon.authz.server") @@ -21,12 +21,15 @@ def create_server(): meta_rule_id = os.getenv("META_RULE_ID") keystone_project_id = os.getenv("KEYSTONE_PROJECT_ID") logger.info("component_type={}".format(component_type)) - conf = configuration.get_configuration("plugins/{}".format(component_type)) - conf["plugins/{}".format(component_type)]['id'] = component_id - hostname = conf["plugins/{}".format(component_type)].get('hostname', - component_id) - port = conf["plugins/{}".format(component_type)].get('port', tcp_port) - bind = conf["plugins/{}".format(component_type)].get('bind', "0.0.0.0") + conf = configuration.get_plugins() + # conf = configuration.get_configuration("plugins/{}".format(component_type)) + # conf["plugins/{}".format(component_type)]['id'] = component_id + if component_type not in conf: + raise exceptions.ConsulComponentNotFound("{} not found".format( + component_type)) + hostname = conf[component_type].get('hostname', component_id) + port = conf[component_type].get('port', tcp_port) + bind = conf[component_type].get('bind', "0.0.0.0") logger.info("Starting server with IP {} on port {} bind to {}".format( hostname, port, bind)) |