user.delete can return a non-json error

Bug #1840887 reported by Kit Randel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Status tracked in 3.6
3.5
Won't Fix
Low
Unassigned
3.6
Triaged
Low
Unassigned

Bug Description

Calling user.delete in some instances can return a non-json error message, e.g.

"("Cannot delete some instances of model 'User' because they are referenced through a protected foreign key: 'Node.owner'", <QuerySet [<Node: rynedt (valued-trout)>, <Node: phdhmt (apt-imp)>, <Node: k3qkkc (model-shrimp)>, <Node: k33w6k (loyal-flea)>, <Node: h7tep7 (smooth-goat)>, <Node: npsbcf (comic-lizard)>, <Node: g4gy3w (heroic-aphid)>, <Node: gy3qan (boss-wren)>, <Node: qg6qyx (steady-goose)>, <Node: fgndqh (model-bug)>, <Node: 8sp3b3 (rare-ghoul)>, <Node: dmmma4 (heroic-gator)>, <Node: m6anbb (eager-goose)>, <Node: egfebe (whole-macaw)>, <Node: 788ydm (guided-wren)>, <Node: tq3p8f (rich-moose)>, <Node: p7eshp (proven-mullet)>, <Node: ma6p7c (sought-lion)>, <Node: wn4gcx (fair-shiner)>, <Node: p6mdrg (cute-adder)>, '...(remaining elements truncated)...']>)"

We have better error handling in maas-ui to handle this now, but it would be nice if the error payload was consistently json.

Potentially this error should be a distinct bug as well.

Changed in maas:
importance: Undecided → Low
status: New → Confirmed
Changed in maas:
status: Confirmed → Triaged
Revision history for this message
Adam Collard (adam-collard) wrote :

Is this still happening?

tags: added: websocket-api
Changed in maas:
status: Triaged → Incomplete
summary: - [ws api] user.delete can return a non-json error
+ user.delete can return a non-json error
Revision history for this message
Jacopo Rota (r00ta) wrote (last edit ):

Yes. In order to reproduce this you can

1. initialize maas
2. create a superuser X
3. create a superuser Y
4. login with Y and create a machine
5. logout Y
6. login with X and try to delete the user Y

Here's the error on the websocket: "("Cannot delete some instances of model 'User' because they are referenced through protected foreign keys: 'Node.owner'.", {<Node: yq4cdd (fds)>})"

Changed in maas:
status: Incomplete → Triaged
Changed in maas:
milestone: none → 3.5.0
Changed in maas:
milestone: 3.5.0 → 3.5.x
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.