Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branching support not enabled for plugins listed after netbox_branching in PLUGINS config parameter #114

Open
jeremystretch opened this issue Sep 11, 2024 · 2 comments
Labels
app: branching type: bug A confirmed report of unexpected behavior in the application

Comments

@jeremystretch
Copy link
Contributor

Plugin Version

v0.4.0

NetBox Version

v4.1.0

Python Version

3.10

Steps to Reproduce

  1. Install netbox_dns (or a similar functional plugin)
  2. Configure PLUGINS as:
PLUGINS = [
    'netbox_branching',
    'netbox_dns',
]
  1. Enter the Python shell (manage.py nbshell) and inspect model registration for branching support. Note that netbox_dns is absent from the list of recognized apps.
>>> from netbox.registry import registry
>>> registry['model_features']['branching'].keys()
dict_keys(['core', 'circuits', 'dcim', 'ipam', 'extras', 'tenancy', 'virtualization', 'vpn', 'wireless'])
  1. Exit the shell and redefine PLUGINS as:
PLUGINS = [
    'netbox_dns',
    'netbox_branching',
]
  1. Enter the Python shell and again inspect the registered models. netbox_dns is now included in the list of apps.
>>> from netbox.registry import registry
>>> registry['model_features']['branching'].keys()
dict_keys(['core', 'circuits', 'dcim', 'ipam', 'extras', 'tenancy', 'virtualization', 'vpn', 'wireless', 'netbox_dns'])

Expected Behavior

Branching support for all plugins should be registered regardless of the order in which plugins are loaded.

Observed Behavior

Branching support is registered only for plugins which are listed before netbox_branching in the PLUGINS list.

@jeremystretch jeremystretch added the type: bug A confirmed report of unexpected behavior in the application label Sep 11, 2024
@jeremystretch jeremystretch self-assigned this Sep 11, 2024
@jeremystretch
Copy link
Contributor Author

Dug into this a bit. It can be addressed by iterating through apps.get_models() under the plugin's ready() method, however we still have an issue determining change logging support for models because registration of that feature is affected by the same race condition.

@jeremystretch
Copy link
Contributor Author

We've worked around this temporarily by documenting the need to list netbox_branching at the end of the PLUGINS list (see #115).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app: branching type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants