Skip to content

Commit

Permalink
fix: plugin manager rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunato committed Nov 13, 2023
1 parent f323366 commit d5773c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 3 additions & 5 deletions eodag/api/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ def __init__(self, user_conf_file_path=None, locations_conf_path=None):
for provider in self.providers_config.keys():
provider_config_init(self.providers_config[provider], stac_provider_config)

# re-create _plugins_manager using up-to-date providers_config
self._plugins_manager = PluginManager(self.providers_config)
# use updated and checked providers_config
self.providers_config = self._plugins_manager.providers_config
# re-build _plugins_manager using up-to-date providers_config
self._plugins_manager.rebuild(self.providers_config)

# store pruned providers configs
self._pruned_providers_config = {}
Expand Down Expand Up @@ -420,7 +418,7 @@ def _prune_providers_list(self):

if update_needed:
# rebuild _plugins_manager with updated providers list
self._plugins_manager = PluginManager(self.providers_config)
self._plugins_manager.rebuild(self.providers_config)

def set_locations_conf(self, locations_conf_path):
"""Set locations configuration.
Expand Down
6 changes: 6 additions & 0 deletions eodag/plugins/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ def __init__(self, providers_config):
)
merge_configs(plugin_providers_config, self.providers_config)
self.providers_config = plugin_providers_config
self.rebuild()

def rebuild(self, providers_config=None):
"""(Re)Build plugin manager mapping and cache"""
if providers_config is not None:
self.providers_config = providers_config

self.build_product_type_to_provider_config_map()
self._built_plugins_cache = {}
Expand Down

0 comments on commit d5773c4

Please sign in to comment.