piston3 token delete cascades
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
Medium
|
Lee Trager | ||
2.3 |
Fix Committed
|
Medium
|
Lee Trager | ||
2.4 |
Fix Committed
|
Medium
|
Lee Trager | ||
2.6 |
Fix Released
|
Medium
|
Lee Trager | ||
2.7 |
Fix Released
|
Medium
|
Lee Trager |
Bug Description
https:/
The current configured behavior is to CASCADE deletes on the token_id column for maasserver_node. This results in nodes potentially being deleted on the event of a token being deleted.
There are several thousand maas nodes in the installation that we manage. We have started to enforce key rotation and it has resulted in nodes being removed from our maas installation, which negatively impacts our users.
Can the token foreign key on_delete attribute be updated to either
- SET_NULL, to keep the node row but set the token_id attribute to null. or,
- PROTECT, to raise an error if there are any node objects related to the token_id
We do not use the juju functionality that requires linking a token to a node, so I can't say which would be better. However, I can't believe that silently deleting nodes out of maas is the best solution.
More info on ForeignKey setup: https:/
Related branches
- Lee Trager (community): Approve
-
Diff: 46 lines (+11/-3)2 files modifiedsrc/maasserver/models/tests/test_userprofile.py (+7/-2)
src/maasserver/models/userprofile.py (+4/-1)
- Lee Trager (community): Approve
-
Diff: 46 lines (+11/-3)2 files modifiedsrc/maasserver/models/tests/test_userprofile.py (+7/-2)
src/maasserver/models/userprofile.py (+4/-1)
- Lee Trager (community): Approve
-
Diff: 46 lines (+11/-3)2 files modifiedsrc/maasserver/models/tests/test_userprofile.py (+7/-2)
src/maasserver/models/userprofile.py (+4/-1)
- Björn Tillenius: Approve
- MAAS Lander: Approve
-
Diff: 46 lines (+11/-3)2 files modifiedsrc/maasserver/models/tests/test_userprofile.py (+7/-2)
src/maasserver/models/userprofile.py (+4/-1)
- Lee Trager (community): Approve
-
Diff: 564 lines (+153/-120)10 files modifiedsrc/maasserver/api/account.py (+1/-1)
src/maasserver/api/machines.py (+21/-9)
src/maasserver/api/tests/test_api.py (+15/-2)
src/maasserver/api/tests/test_machine.py (+40/-16)
src/maasserver/api/tests/test_machines.py (+13/-48)
src/maasserver/models/node.py (+10/-7)
src/maasserver/models/tests/test_node.py (+29/-32)
src/maasserver/models/tests/test_userprofile.py (+9/-1)
src/maasserver/models/userprofile.py (+7/-2)
src/maasserver/node_action.py (+8/-2)
- Lee Trager (community): Approve
-
Diff: 557 lines (+147/-120)10 files modifiedsrc/maasserver/api/account.py (+1/-1)
src/maasserver/api/machines.py (+21/-9)
src/maasserver/api/tests/test_api.py (+15/-2)
src/maasserver/api/tests/test_machine.py (+40/-16)
src/maasserver/api/tests/test_machines.py (+13/-48)
src/maasserver/models/node.py (+10/-7)
src/maasserver/models/tests/test_node.py (+29/-32)
src/maasserver/models/tests/test_userprofile.py (+9/-1)
src/maasserver/models/userprofile.py (+7/-2)
src/maasserver/node_action.py (+2/-2)
- Lee Trager (community): Approve
-
Diff: 820 lines (+361/-128)13 files modifiedsrc/maasserver/api/account.py (+1/-1)
src/maasserver/api/machines.py (+12/-9)
src/maasserver/api/tests/test_api.py (+15/-2)
src/maasserver/api/tests/test_machine.py (+40/-16)
src/maasserver/api/tests/test_machines.py (+23/-54)
src/maasserver/models/node.py (+11/-7)
src/maasserver/models/tests/test_node.py (+29/-32)
src/maasserver/models/tests/test_userprofile.py (+9/-1)
src/maasserver/models/userprofile.py (+7/-2)
src/maasserver/node_action.py (+2/-2)
src/maasserver/tests/test_node_action.py (+1/-2)
src/maasserver/websockets/handlers/tests/test_token.py (+115/-0)
src/maasserver/websockets/handlers/token.py (+96/-0)
- Lee Trager (community): Approve
-
Diff: 556 lines (+71/-99)13 files modifiedsrc/maasserver/api/account.py (+1/-1)
src/maasserver/api/machines.py (+5/-6)
src/maasserver/api/tests/test_api.py (+12/-2)
src/maasserver/api/tests/test_machine.py (+0/-4)
src/maasserver/api/tests/test_machines.py (+8/-52)
src/maasserver/models/node.py (+1/-5)
src/maasserver/models/tests/test_node.py (+4/-19)
src/maasserver/models/tests/test_userprofile.py (+9/-1)
src/maasserver/models/userprofile.py (+5/-1)
src/maasserver/node_action.py (+2/-2)
src/maasserver/tests/test_node_action.py (+1/-3)
src/maasserver/websockets/handlers/tests/test_token.py (+11/-2)
src/maasserver/websockets/handlers/token.py (+12/-1)
- Alberto Donato: Approve
- MAAS Lander: Approve
-
Diff: 435 lines (+33/-101)8 files modifiedsrc/maasserver/api/machines.py (+5/-6)
src/maasserver/api/tests/test_machine.py (+0/-4)
src/maasserver/api/tests/test_machines.py (+8/-52)
src/maasserver/migrations/maasserver/0206_remove_node_token.py (+12/-0)
src/maasserver/models/node.py (+1/-15)
src/maasserver/models/tests/test_node.py (+4/-19)
src/maasserver/node_action.py (+2/-2)
src/maasserver/tests/test_node_action.py (+1/-3)
Changed in maas: | |
milestone: | none → 2.8.0b1 |
status: | New → Triaged |
importance: | Undecided → High |
importance: | High → Medium |
Changed in maas: | |
assignee: | nobody → Lee Trager (ltrager) |
Changed in maas: | |
status: | Triaged → Fix Committed |
Changed in maas: | |
status: | Fix Committed → Fix Released |
MAAS doesn't expect others to be modifying the database. The OAUTH keys stored are passed to the deployed machine and used to communicate back to MAAS. By deleting them the machine won't be able to authenticate and communicate back with MAAS. Removing the current keys could break any ephemeral environment or deployment.
MAAS does remove keys when they are no longer needed however the key needs to remain the same as long as the machine is deployed. This is because cloud-init accesses the metadata service on every boot. We *may* be able to change that but we'd have to do some investigation.