mirror of
https://github.com/netbox-community/netbox.git
synced 2026-02-04 14:26:25 -06:00
12416 warning for missing script file (#12456)
* 12416 warning for missing script file * 12416 widen exception catching for internal script error * Update netbox/extras/models/scripts.py Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com> * 12416 update from review feedback --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import inspect
|
||||
import logging
|
||||
from functools import cached_property
|
||||
|
||||
from django.db import models
|
||||
@@ -16,6 +17,8 @@ __all__ = (
|
||||
'ScriptModule',
|
||||
)
|
||||
|
||||
logger = logging.getLogger('netbox.data_backends')
|
||||
|
||||
|
||||
class Script(WebhooksMixin, models.Model):
|
||||
"""
|
||||
@@ -53,7 +56,12 @@ class ScriptModule(PythonModuleMixin, JobsMixin, ManagedFile):
|
||||
# For child objects in submodules use the full import path w/o the root module as the name
|
||||
return cls.full_name.split(".", maxsplit=1)[1]
|
||||
|
||||
module = self.get_module()
|
||||
try:
|
||||
module = self.get_module()
|
||||
except Exception as e:
|
||||
logger.debug(f"Failed to load script: {self.python_name} error: {e}")
|
||||
module = None
|
||||
|
||||
scripts = {}
|
||||
ordered = getattr(module, 'script_order', [])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user