mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	make startup more failsafe
This commit is contained in:
		@@ -889,6 +889,7 @@ INTEGRATION_PLUGIN_GLOBALSETTING = {}
 | 
				
			|||||||
INTEGRATION_APPS_LOADING = True     # Marks if apps were reloaded yet
 | 
					INTEGRATION_APPS_LOADING = True     # Marks if apps were reloaded yet
 | 
				
			||||||
INTEGRATION_PLUGINS_RELOADING = False
 | 
					INTEGRATION_PLUGINS_RELOADING = False
 | 
				
			||||||
INTEGRATION_APPS_PATHS = []         # Holds all added plugin_paths
 | 
					INTEGRATION_APPS_PATHS = []         # Holds all added plugin_paths
 | 
				
			||||||
 | 
					INTEGRATION_STARTUP_ERRORS = {}     # Holds discovering errors
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Test settings
 | 
					# Test settings
 | 
				
			||||||
PLUGIN_TESTING = get_setting('PLUGIN_TESTING', TESTING)  # used to force enable everything plugin
 | 
					PLUGIN_TESTING = get_setting('PLUGIN_TESTING', TESTING)  # used to force enable everything plugin
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,6 +41,17 @@ def get_modules(pkg, recursive: bool = False):
 | 
				
			|||||||
            context[name] = module
 | 
					            context[name] = module
 | 
				
			||||||
        except AppRegistryNotReady:
 | 
					        except AppRegistryNotReady:
 | 
				
			||||||
            pass
 | 
					            pass
 | 
				
			||||||
 | 
					        except Exception as error:
 | 
				
			||||||
 | 
					            # this 'protects' against malformed plugin modules by more or less silently failing
 | 
				
			||||||
 | 
					            # TODO log
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            # make sure the registry is set up
 | 
				
			||||||
 | 
					            if 'discovery' not in settings.INTEGRATION_STARTUP_ERRORS:
 | 
				
			||||||
 | 
					                settings.INTEGRATION_STARTUP_ERRORS['discovery'] = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            # add error to stack
 | 
				
			||||||
 | 
					            settings.INTEGRATION_STARTUP_ERRORS['discovery'].append({name: str(error)})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return [v for k, v in context.items()]
 | 
					    return [v for k, v in context.items()]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user