Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions src/satosa/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,7 @@ def endpoint_routing(self, context):
)
logger.debug(logline)
raise SATOSABadContextError("Context did not contain any path")

msg = "Routing path: {path}".format(path=context.path)
logline = lu.LOG_FMT.format(id=lu.get_session_id(context.state), message=msg)
logger.debug(logline)

path_split = context.path.split("/")
backend = path_split[0]

Expand All @@ -167,6 +164,10 @@ def endpoint_routing(self, context):
)
logger.debug(logline)

msg = "Routing path: {path}".format(path=context.path)
logline = lu.LOG_FMT.format(id=lu.get_session_id(context.state), message=msg)
logger.debug(logline)

try:
name, frontend_endpoint = self._find_registered_endpoint(context, self.frontends)
except ModuleRouter.UnknownEndpoint:
Expand All @@ -183,9 +184,12 @@ def endpoint_routing(self, context):
context.target_micro_service = name
return micro_service_endpoint

if backend in self.backends:
backend_endpoint = self._find_registered_backend_endpoint(context)
if backend_endpoint:
return backend_endpoint

try:
name, backend_endpoint = self._find_registered_endpoint(context, self.backends)
except ModuleRouter.UnknownEndpoint:
pass
else:
context.target_backend = name
return backend_endpoint

raise SATOSANoBoundEndpointError("'{}' not bound to any function".format(context.path))