mirror of
https://github.com/inventree/InvenTree.git
synced 2026-03-11 14:44:18 +00:00
* Check for null plugin config
* Handle potential errors
(cherry picked from commit 2e675ee87a)
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
committed by
GitHub
parent
ed8331e26a
commit
44387f3bb4
@@ -473,12 +473,19 @@ class PluginsRegistry:
|
||||
|
||||
# Ensure that each loaded plugin has a valid configuration object in the database
|
||||
for plugin in self.plugins.values():
|
||||
config = self.get_plugin_config(plugin.slug)
|
||||
if config := self.get_plugin_config(plugin.slug):
|
||||
# Ensure mandatory plugins are marked as active
|
||||
if config.is_mandatory() and not config.active:
|
||||
config.active = True
|
||||
|
||||
# Ensure mandatory plugins are marked as active
|
||||
if config.is_mandatory() and not config.active:
|
||||
config.active = True
|
||||
config.save(no_reload=True)
|
||||
try:
|
||||
config.save(no_reload=True)
|
||||
except (OperationalError, ProgrammingError):
|
||||
# Database is not ready, cannot save config
|
||||
logger.warning(
|
||||
"Database not ready - cannot set mandatory flag for plugin '%s'",
|
||||
plugin.slug,
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
logger.exception('Unexpected error during plugin reload: %s', e)
|
||||
|
||||
Reference in New Issue
Block a user