✨ Add Clear Cache button
Netbox Version | Plugin Version |
---|---|
v3.6.9 | v0.25.1 |
Desired Behavior
In the "Cache Configuration" view of a Mapping entity, there should be a button labelled "Clear Cache".
Clicking that button should set a new field operation
on the mapping to clear-cache
so that we, as RPS squad, can configure a Webhook in Netbox to perform said operation.
For example:
sequenceDiagram
actor SecOps
participant Netbox
participant AWX
participant Job as AWX Job: clear_mapping_cache
participant RPS_VM as RPS Virtual Machine
SecOps-->>Netbox: Click "Purge Cache" button
Netbox-->>Netbox: Set mapping "operation" field to "clear-cache"
Netbox-->>AWX: Trigger Update Webhook on mapping
AWX-->>Job: Trigger Job "clear_mapping_cache"
Job-->>Netbox: Update mapping journal "operation clear-cache: pending"
Job-->>RPS_VM: cURL with correct headers
Job-->>Netbox: Update mapping journal "operation clear-cache: done (or failed)"
Job-->>Netbox: Set mapping "operation" field to "none"
The new field operation
is identical to how the Netbox Docker plugin works, see their source code:
- ChoiceSet
- Field in Container model
- Edit form
- Edit view controller
- URL entry in router
- Button in template
At the moment, the field operation
should have the following available choices:
clear-cache
none
More could come later on.