Skip to content

Commit

Permalink
Return an empty dict if the module cannot be loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSheps authored and jeremystretch committed May 8, 2024
1 parent d7f652b commit d7d97b1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion netbox/extras/migrations/0109_script_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ def get_name(cls):
return cls.full_name.split(".", maxsplit=1)[1]

loader = SourceFileLoader(get_python_name(scriptmodule), get_full_path(scriptmodule))
module = loader.load_module()
try:
module = loader.load_module()
except FileNotFoundError:
return {}

scripts = {}
ordered = getattr(module, 'script_order', [])
Expand Down

0 comments on commit d7d97b1

Please sign in to comment.