Skip to content

Invalid import inside plugin code can result in partially loaded plugin #4628

@dgarros

Description

@dgarros

Environment

  • Python version: 3.7.7
  • NetBox version: 2.8.3

Steps to Reproduce

  1. Install a plugin that is importing a non valid object, for example in views.py
  2. Start NetBox
  3. Navigate to the plugin section in the admin page (/admin/plugins/installed-plugins/)

Expected Behavior

If a plugin code is not valid an error message should be generated when NetBox is starting and the plugin should be ignored/not installed.

Ideally the error message should provide some information to troubleshoot the issue.

Observed Behavior

When the code of a plugin is not valid, there is no error message visible when NetBox start and the plugin is partially loaded.
The plugin will be listed under /admin/plugins/installed-plugins/
Depending on what is broken and what features the plugin is using it could result in a broken UI too.
In my case the import error was in the views.py file and the plugin included a navigation.py file to add a menu.
The UI was not working anymore because the namespace of the plugin was not properly defined.

NoReverseMatch at /
'netbox_onboarding' is not a registered namespace inside 'plugins'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions