mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Return an empty dict if the module cannot be loaded
This commit is contained in:
committed by
Jeremy Stretch
parent
d7f652bcc7
commit
d7d97b1b52
@ -60,7 +60,10 @@ def get_module_scripts(scriptmodule):
|
|||||||
return cls.full_name.split(".", maxsplit=1)[1]
|
return cls.full_name.split(".", maxsplit=1)[1]
|
||||||
|
|
||||||
loader = SourceFileLoader(get_python_name(scriptmodule), get_full_path(scriptmodule))
|
loader = SourceFileLoader(get_python_name(scriptmodule), get_full_path(scriptmodule))
|
||||||
|
try:
|
||||||
module = loader.load_module()
|
module = loader.load_module()
|
||||||
|
except FileNotFoundError:
|
||||||
|
return {}
|
||||||
|
|
||||||
scripts = {}
|
scripts = {}
|
||||||
ordered = getattr(module, 'script_order', [])
|
ordered = getattr(module, 'script_order', [])
|
||||||
|
Reference in New Issue
Block a user