SyncServer - check configured sites more effectively

This commit is contained in:
Petr Kalis 2021-05-11 14:43:26 +02:00
parent e4b51604ad
commit 49e44f0d70

View file

@ -206,10 +206,10 @@ def _get_configured_sites_from_setting(module, project_name, project_setting):
all_sites = module._get_default_site_configs() all_sites = module._get_default_site_configs()
all_sites.update(project_setting.get("sites")) all_sites.update(project_setting.get("sites"))
for site_name, config in all_sites.items(): for site_name, config in all_sites.items():
handler = initiated_handlers. \ provider = module.get_provider_for_site(site=site_name)
get((config["provider"], site_name)) handler = initiated_handlers.get((provider, site_name))
if not handler: if not handler:
handler = lib.factory.get_provider(config["provider"], handler = lib.factory.get_provider(provider,
project_name, project_name,
site_name, site_name,
presets=config) presets=config)
@ -454,8 +454,9 @@ class SyncServerThread(threading.Thread):
remote_site)) remote_site))
return None, None return None, None
if not all([site_is_working(self.module, collection, local_site), configured_sites = _get_configured_sites(self.module, collection)
site_is_working(self.module, collection, remote_site)]): if not all([local_site in configured_sites,
remote_site in configured_sites]):
log.debug("Some of the sites {} - {} is not ".format(local_site, log.debug("Some of the sites {} - {} is not ".format(local_site,
remote_site) + remote_site) +
"working properly") "working properly")