SaaShup / netbox-docker-plugin

Netbox Docker Plugin
https://saashup.com
BSD 3-Clause "New" or "Revised" License
64 stars 5 forks source link

:sparkles: Restrict container actions #120

Closed linkdd closed 6 months ago

linkdd commented 6 months ago

Decision Record

Closes #119. Closes https://github.com/SaaShup/netbox-docker-agent/issues/55

Actions on a container should not be possible based on its state:

created restarting running paused exited dead none
Create
Start
Stop
Restart
Recreate
Delete
--- --- --- --- --- --- --- ---
None

(edited by @lvenier)

NB: If the state is none (therefore, the agent failed to communicate the container's real state), then we prevent any action until it is resolved, as we cannot guarantee anything, except when:

It does not seem possible to add a disabled state to the delete/bulk-delete buttons in Netbox. Therefore, the pre_delete model signal should be intercepted to apply the constraint there.

Changes

github-actions[bot] commented 6 months ago

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
2152 2118 98% 90%

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: 235665c by action🐍

lvenier commented 6 months ago
created restarting running paused exited dead none
Create
Start
Stop
Restart
Recreate
Delete
lvenier commented 6 months ago

I see an improvement for the next PR : if container operation == "none" then no operation allowed on container