1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Allow user to override module name

This commit is contained in:
Jeremy Stretch
2019-08-13 09:09:12 -04:00
parent 44fd0ebb2d
commit 3d6a583ce4
2 changed files with 8 additions and 0 deletions

View File

@ -233,6 +233,8 @@ def get_scripts():
# defined.
for importer, module_name, _ in pkgutil.iter_modules([settings.SCRIPTS_ROOT]):
module = importer.find_module(module_name).load_module(module_name)
if hasattr(module, 'name'):
module_name = module.name
module_scripts = OrderedDict()
for name, cls in inspect.getmembers(module, is_script):
module_scripts[name] = cls