12416 update from review feedback

This commit is contained in:
Arthur 2023-05-04 12:00:45 -07:00
parent 5976d8484e
commit 364f20f620
2 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import inspect import inspect
import logging
from functools import cached_property from functools import cached_property
from django.db import models from django.db import models
@ -16,6 +17,8 @@ __all__ = (
'ScriptModule', 'ScriptModule',
) )
logger = logging.getLogger('netbox.data_backends')
class Script(WebhooksMixin, models.Model): class Script(WebhooksMixin, models.Model):
""" """
@ -56,6 +59,7 @@ class ScriptModule(PythonModuleMixin, JobsMixin, ManagedFile):
try: try:
module = self.get_module() module = self.get_module()
except Exception as e: except Exception as e:
logger.debug(f"Failed to load script: {self.python_name} error: {e}")
module = None module = None
scripts = {} scripts = {}

View File

@ -39,9 +39,7 @@
{% include 'inc/sync_warning.html' with object=module %} {% include 'inc/sync_warning.html' with object=module %}
{% if not module.scripts %} {% if not module.scripts %}
<div class="alert alert-warning d-flex align-items-center" role="alert"> <div class="alert alert-warning d-flex align-items-center" role="alert">
<div> <i class="mdi mdi-alert"></i>&nbsp; Script file at: {{module.full_path}} could not be loaded.
Warning: Script file at: <strong>{{ module.full_path }}"</strong> is either missing or has a problem with the script code, please check the file.
</div>
</div> </div>
{% else %} {% else %}
<table class="table table-hover table-headings reports"> <table class="table table-hover table-headings reports">