mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-13 08:51:38 +08:00
Move logic of whether to load a config into can_load_config_file and fix unit tests
This commit is contained in:
@@ -255,6 +255,19 @@ class ToolBox(BaseGalaxyToolBox):
|
||||
app=app,
|
||||
)
|
||||
|
||||
def can_load_config_file(self, config_filename):
|
||||
if config_filename == self.app.config.shed_tool_config_file and not self.app.config.shed_tool_config_file_set:
|
||||
if self.dynamic_confs():
|
||||
# Do not load or create a default shed_tool_config_file if another shed_tool_config file has already been loaded
|
||||
return False
|
||||
elif self.app.config.tool_config_file_set:
|
||||
log.warning(
|
||||
"The default shed tool config file (%s) has been added to the tool_config_file option, if this is "
|
||||
"not the desired behavior, please set shed_tool_config_file to your primary shed-enabled tool "
|
||||
"config file", self.app.config.shed_tool_config_file
|
||||
)
|
||||
return True
|
||||
|
||||
def has_reloaded(self, other_toolbox):
|
||||
return self._reload_count != other_toolbox._reload_count
|
||||
|
||||
|
||||
@@ -127,6 +127,9 @@ class AbstractToolBox(Dictifiable, ManagesIntegratedToolPanelMixin):
|
||||
def create_dynamic_tool(self, dynamic_tool):
|
||||
raise NotImplementedError()
|
||||
|
||||
def can_load_config_file(self, config_filename):
|
||||
return True
|
||||
|
||||
def _init_tools_from_configs(self, config_filenames):
|
||||
""" Read through all tool config files and initialize tools in each
|
||||
with init_tools_from_config below.
|
||||
@@ -141,16 +144,8 @@ class AbstractToolBox(Dictifiable, ManagesIntegratedToolPanelMixin):
|
||||
config_filenames.remove(config_filename)
|
||||
config_filenames.extend(directory_config_files)
|
||||
for config_filename in config_filenames:
|
||||
if config_filename == self.app.config.shed_tool_config_file and not self.app.config.shed_tool_config_file_set:
|
||||
if self.dynamic_confs():
|
||||
# Do not load or create a default shed_tool_config_file if another shed_tool_config file has already been loaded
|
||||
continue
|
||||
elif self.app.config.tool_config_file_set:
|
||||
log.warning(
|
||||
"The default shed tool config file (%s) has been added to the tool_config_file option, if this is "
|
||||
"not the desired behavior, please set shed_tool_config_file to your primary shed-enabled tool "
|
||||
"config file", self.app.config.shed_tool_config_file
|
||||
)
|
||||
if not self.can_load_config_file(config_filename):
|
||||
continue
|
||||
try:
|
||||
self._init_tools_from_config(config_filename)
|
||||
except ParseError:
|
||||
|
||||
@@ -145,6 +145,8 @@ class MockAppConfig(Bunch):
|
||||
self.builds_file_path = os.path.join('tool-data', 'shared', 'ucsc', 'builds.txt.sample')
|
||||
|
||||
self.migrated_tools_config = "/tmp/migrated_tools_conf.xml"
|
||||
self.shed_tool_config_file = "config/shed_tool_conf.xml"
|
||||
self.shed_tool_config_file_set = False
|
||||
self.preserve_python_environment = "always"
|
||||
self.enable_beta_gdpr = False
|
||||
self.legacy_eager_objectstore_initialization = True
|
||||
|
||||
Reference in New Issue
Block a user