Skip to content

Commit

Permalink
Clean up ancient ad-hoc migration of user_connections
Browse files Browse the repository at this point in the history
This hook was adding disabled and type fields to the user_connections if
missing. It looks like these fields have been added to all configs in
previous versions, so that we can remove this ad-hoc migration now.

Change-Id: I1353d1749f2e7d41615e7629f032546babe6200a
  • Loading branch information
LarsMichelsen committed Jan 13, 2025
1 parent a6d1f2b commit c89be38
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
12 changes: 0 additions & 12 deletions cmk/gui/userdb/_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,18 +295,6 @@ def get_active_saml_connections() -> dict[str, SAMLUserConnectionConfig]:
}


# The saved configuration for user connections is a bit inconsistent, let's fix
# this here once and for all.
def fix_user_connections() -> None:
for cfg in active_config.user_connections:
# Although our current configuration always seems to have a 'disabled'
# entry, this might not have always been the case.
cfg.setdefault("disabled", False)
# Only migrated configurations have a 'type' entry, all others are
# implictly LDAP connections.
cfg.setdefault("type", "ldap")


def locked_attributes(connection_id: str | None) -> Sequence[str]:
"""Returns a list of connection specific locked attributes"""
return _get_attributes(connection_id, lambda c: c.locked_attributes())
Expand Down
3 changes: 0 additions & 3 deletions cmk/gui/userdb/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
from datetime import timedelta

from cmk.gui.background_job import BackgroundJobRegistry
from cmk.gui.config import register_post_config_load_hook
from cmk.gui.cron import CronJob, CronJobRegistry
from cmk.gui.pages import PageRegistry
from cmk.gui.watolib.groups import ContactGroupUsageFinderRegistry
from cmk.gui.watolib.timeperiods import TimeperiodUsageFinderRegistry

from . import ldap_connector, user_attributes
from ._connections import fix_user_connections
from ._connector import UserConnectorRegistry
from ._find_usage import find_timeperiod_usage_in_users, find_usages_of_contact_group_in_users
from ._user_attribute import UserAttributeRegistry
Expand All @@ -35,7 +33,6 @@ def register(
) -> None:
user_attributes.register(user_attribute_registry)

register_post_config_load_hook(fix_user_connections)
cron_job_registry.register(
CronJob(
name="execute_userdb_job",
Expand Down

0 comments on commit c89be38

Please sign in to comment.