Skip to content
Open
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
17 changes: 16 additions & 1 deletion src/satosa/plugin_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from .micro_services.base import (MicroService, RequestMicroService, ResponseMicroService)

logger = logging.getLogger(__name__)

names = []

@contextmanager
def prepend_to_import_path(import_paths):
Expand Down Expand Up @@ -46,6 +46,14 @@ def load_backends(config, callback, internal_attributes):
config["BACKEND_MODULES"],
backend_filter, config["BASE"],
internal_attributes, callback)

for backend in backend_modules:
if backend.name in names:
raise SATOSAConfigurationError("The name " + backend.name + " is taken!")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise SATOSAConfigurationError("The name " + backend.name + " is taken!")
raise SATOSAConfigurationError("The backend name " + backend.name + " is already used.")


else:
names.append(backend.name)

logger.info("Setup backends: {}".format([backend.name for backend in backend_modules]))
return backend_modules

Expand All @@ -67,6 +75,13 @@ def load_frontends(config, callback, internal_attributes):
"""
frontend_modules = _load_plugins(config.get("CUSTOM_PLUGIN_MODULE_PATHS"), config["FRONTEND_MODULES"],
frontend_filter, config["BASE"], internal_attributes, callback)

for frontend in frontend_modules:
if frontend.name in names:
raise SATOSAConfigurationError("The name " + frontend.name + " is taken!")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise SATOSAConfigurationError("The name " + frontend.name + " is taken!")
raise SATOSAConfigurationError("The frontend name " + frontend.name + " is already used.")

else:
names.append(frontend.name)

logger.info("Setup frontends: {}".format([frontend.name for frontend in frontend_modules]))
return frontend_modules

Expand Down