File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -1978,18 +1978,19 @@ def _restart_metrics_service(self) -> None:
1978
1978
1979
1979
def _restart_ldap_sync_service (self ) -> None :
1980
1980
"""Restart the LDAP sync service in case any configuration changed."""
1981
- if not self .is_primary :
1982
- return
1983
-
1984
1981
container = self .unit .get_container ("postgresql" )
1985
1982
sync_service = container .pebble .get_services (names = [self .ldap_sync_service ])
1986
1983
1987
- if not self .is_ldap_enabled and sync_service [0 ].is_running ():
1984
+ if not self .is_primary and sync_service [0 ].is_running ():
1985
+ logger .debug ("Stopping LDAP sync service. It must only run in the primary" )
1986
+ container .stop (self .pg_ldap_sync_service )
1987
+
1988
+ if self .is_primary and not self .is_ldap_enabled :
1988
1989
logger .debug ("Stopping LDAP sync service" )
1989
1990
container .stop (self .ldap_sync_service )
1990
1991
return
1991
1992
1992
- if self .is_ldap_enabled :
1993
+ if self .is_primary and self . is_ldap_enabled :
1993
1994
container .add_layer (
1994
1995
self .ldap_sync_service ,
1995
1996
Layer ({"services" : {self .ldap_sync_service : self ._generate_ldap_service ()}}),
You can’t perform that action at this time.
0 commit comments