Skip to content

Commit

Permalink
Add failed_to_load logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bctiemann committed Feb 25, 2025
1 parent d802f93 commit 26bac97
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion netbox/core/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Plugin:
release_recent_history: list[PluginVersion] = field(default_factory=list)
is_local: bool = False # extra field for locally installed plugins
is_installed: bool = False
failed_to_load: bool = False
installed_version: str = ''
netbox_min_version: str = ''
netbox_max_version: str = ''
Expand Down Expand Up @@ -93,7 +94,8 @@ def get_local_plugins(plugins=None):
tag_line=plugin_config.description,
description_short=plugin_config.description,
is_local=True,
is_installed=plugin_name in registry['plugins']['installed'],
is_installed=True,
failed_to_load=plugin_name not in registry['plugins']['installed'],
installed_version=installed_version,
netbox_min_version=plugin_config.min_version,
netbox_max_version=plugin_config.max_version,
Expand Down
2 changes: 1 addition & 1 deletion netbox/netbox/tables/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ def __init__(self, *args, tooltip=None, **kwargs):
super().__init__(*args, **kwargs)

def render(self, value, record, table, **kwargs):
if not value and self.false_mark:
if record.failed_to_load:
tooltip = (
f'Could not load due to NetBox version incompatibility. '
f'Min version: {record.netbox_min_version}, max version: {record.netbox_max_version}'
Expand Down

0 comments on commit 26bac97

Please sign in to comment.