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

Plugin events pipeline registration #15093

Closed
natm opened this issue Feb 8, 2024 · 3 comments · Fixed by #17717
Closed

Plugin events pipeline registration #15093

natm opened this issue Feb 8, 2024 · 3 comments · Fixed by #17717
Assignees
Labels
complexity: medium Requires a substantial but not unusual amount of effort to implement status: accepted This issue has been accepted for implementation topic: plugins Relates to the plugins framework type: feature Introduction of new functionality to the application
Milestone

Comments

@natm
Copy link
Member

natm commented Feb 8, 2024

NetBox version

v3.7.2

Feature type

New functionality

Proposed functionality

3.7.0 introduced the events pipeline described in #14132

This involves making an entry in EVENTS_PIPELINE=[] within configuration.py, it would be more ergonomic if plugins could register for events by declaring intent within their configuration.

For example:

from netbox.plugins import PluginConfig

class FooBarConfig(PluginConfig):
    name = 'foo_bar'
    verbose_name = 'Foo Bar'
    description = 'An example NetBox plugin'
    version = '0.1'
    author = 'Jeremy Stretch'
    author_email = 'author@example.com'
    base_url = 'foo-bar'
    required_settings = []
    default_settings = {
        'baz': True
    }
    events_pipeline_registrations = [
         "foobar.mymodule.custom_event_handler"
    ]
    django_apps = ["foo", "bar", "baz"]

config = FooBarConfig

events_pipeline_registrations would be optional to allow for backwards compatibility and default to []

It would allow plugins which require access to the events pipeline to have entries added into EVENTS_PIPELINE automatically. This reduces complexity on those installing Netbox plugins which need events access.

https://linear.app/netboxlabs/issue/BIZ-6/

Use case

Simplify access to the events pipeline for plugins, reduce configuration complexity.

Database changes

No response

External dependencies

No response

@natm natm added the type: feature Introduction of new functionality to the application label Feb 8, 2024
@jeffgdotorg
Copy link
Contributor

@arthanson does ordering matter in the EVENTS_PIPELINE list? Do we anticipate needing a mechanism to shape the smushing together of the per-plugin list with the one in configuration.py?

@jeffgdotorg
Copy link
Contributor

This feature is essential for the evolution of plugins into more self-contained units, but it also requires a change to the plugin API that we cannot introduce at a micro-version boundary (3.7.2 -> 3.7.3). The soonest our semantic versioning contract would permit it is v4.0.

In the meantime, we can consider alternative approaches that don't involve changes to the plugin API.

@jeremystretch jeremystretch added the status: needs triage This issue is awaiting triage by a maintainer label Mar 26, 2024
@jeffgdotorg jeffgdotorg added needs milestone Awaiting prioritization for inclusion with a future NetBox release and removed status: needs triage This issue is awaiting triage by a maintainer labels Apr 3, 2024
@jeffgdotorg
Copy link
Contributor

Getting this issue out ot triage jail. We should revisit once the dust has settled from 4.0b1 and consider whether to take on the full implementation in v4.1, or look for an alternative approach that can be done within an existing release train without violating the plugin API's semver.

@jeremystretch jeremystretch added status: backlog Awaiting selection for work topic: plugins Relates to the plugins framework complexity: medium Requires a substantial but not unusual amount of effort to implement labels May 21, 2024
@netbox-community netbox-community deleted a comment from natm Jun 3, 2024
@jeremystretch jeremystretch added this to the v4.2 milestone Sep 26, 2024
@jeremystretch jeremystretch removed the needs milestone Awaiting prioritization for inclusion with a future NetBox release label Sep 26, 2024
@arthanson arthanson self-assigned this Oct 8, 2024
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: backlog Awaiting selection for work labels Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: medium Requires a substantial but not unusual amount of effort to implement status: accepted This issue has been accepted for implementation topic: plugins Relates to the plugins framework type: feature Introduction of new functionality to the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants