nautobot / nautobot

Network Source of Truth & Network Automation Platform
https://docs.nautobot.com
Apache License 2.0
1.01k stars 269 forks source link

Add filter constraints to job hooks similar to dynamic groups #2302

Open gsnider2195 opened 2 years ago

gsnider2195 commented 2 years ago

As ...

P.D. - Plugin Developer

I want ...

To be able to constrain job hooks to more than just the content type and change action.

So that ...

My plugin can create multiple job hooks that run jobs based on the value of a model field instead of having to create multiple models.

I know this is done when...

I can assign filter criteria to job hooks and those job hooks will only trigger when the content type, change action and filter criteria match.

Example model:

class SyslogMessage(OrganizationalModel):
    event_source = models.CharField(max_length=100)
    event_type = models.CharField(max_length=100)
    event_id = models.PositiveIntegerField()

Configuration was changed, run configuration compliance check if event_id==111010 run job ComplianceJob

High cpu utilization, alert NOC if event_id==211003 run job EmailNOC

Optional - Feature groups this request pertains to.

Database Changes

Filter field would need to be added to the JobHook model. Could probably be modeled off of DynamicGroup.filter

External Dependencies

None

glennmatthews commented 5 days ago

Relates to #6143