Unable to delete account if the project is removed
- Vorherrschende Sprache
- Java
- Sterne
- 3.1k
- Forks
- 1.4k
- Ø Merge
- 6 T. 19 Std.
- Gemergte PRs (30 T.)
- 32
Beschreibung
### problem
Unable to delete account if the project is removed
### versions
ACS 4.22
### The steps to reproduce the bug
1. Create a project
2. Create a account/user with User role
3. Add User to the project, Select the project role as Admin
5. Delete the project with clean up option
6. Delete the user
7. Disable the account and Delete the account >> Exception observed
```
2026-02-06 05:19:09,201 DEBUG [c.c.a.ApiServer] (qtp1390913202-23:[ctx-52b15b57, ctx-b39021de]) (logid:c0aa78bd) Retrieved cmdEventType from job info: ACCOUNT.DELETE
2026-02-06 05:19:09,203 INFO [o.a.c.f.j.i.AsyncJobMonitor] (API-Job-Executor-22:[ctx-54696ea9, job-166]) (logid:92e3ffb4) Add job-166 into job monitoring
2026-02-06 05:19:09,204 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (qtp1390913202-23:[ctx-52b15b57, ctx-b39021de]) (logid:c0aa78bd) submit async job-166, details: AsyncJob {"accountId":2,"cmd":"org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd","cmdInfo":"{\"response\":\"json\",\"ctxUserId\":\"2\",\"sessionkey\":\"nDTziuDnO4qxnRScKDVyKQTZukU\",\"httpmethod\":\"POST\",\"ctxStartEventId\":\"623\",\"id\":\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\",\"ctxDetails\":\"{\\\"interface com.cloud.user.Account\\\":\\\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\\\"}\",\"ctxAccountId\":\"2\",\"uuid\":\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\",\"cmdEventType\":\"ACCOUNT.DELETE\"}","cmdVersion":0,"completeMsid":null,"created":null,"id":166,"initMsid":32988016411316,"instanceId":12,"instanceType":"Account","lastPolled":null,"lastUpdated":null,"processStatus":0,"removed":null,"result":null,"resultCode":0,"status":"IN_PROGRESS","userId":2,"uuid":"1ba7a022-f715-4df5-a771-99e59e80e38f"}
2026-02-06 05:19:09,204 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl$5] (API-Job-Executor-22:[ctx-54696ea9, job-166]) (logid:1ba7a022) Executing AsyncJob {"accountId":2,"cmd":"org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd","cmdInfo":"{\"response\":\"json\",\"ctxUserId\":\"2\",\"sessionkey\":\"nDTziuDnO4qxnRScKDVyKQTZukU\",\"httpmethod\":\"POST\",\"ctxStartEventId\":\"623\",\"id\":\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\",\"ctxDetails\":\"{\\\"interface com.cloud.user.Account\\\":\\\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\\\"}\",\"ctxAccountId\":\"2\",\"uuid\":\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\",\"cmdEventType\":\"ACCOUNT.DELETE\"}","cmdVersion":0,"completeMsid":null,"created":null,"id":166,"initMsid":32988016411316,"instanceId":12,"instanceType":"Account","lastPolled":null,"lastUpdated":null,"processStatus":0,"removed":null,"result":null,"resultCode":0,"status":"IN_PROGRESS","userId":2,"uuid":"1ba7a022-f715-4df5-a771-99e59e80e38f"}
2026-02-06 05:19:09,205 DEBUG [c.c.a.ApiServlet] (qtp1390913202-23:[ctx-52b15b57, ctx-b39021de]) (logid:c0aa78bd) ===END=== 10.0.3.251 -- POST
command=deleteAccount
response=json
id=f004ffb3-f8d0-4297-8951-fc83bdd10fad
sessionkey=nDTziuDnO4qxnRScKDVyKQTZukU
2026-02-06 05:19:09,207 DEBUG [c.c.u.AccountManagerImpl] (API-Job-Executor-22:[ctx-54696ea9, job-166, ctx-32d73b76]) (logid:1ba7a022) Account [Account [{"accountName":"admin","id":2,"uuid":"ef7f35bc-fffc-11f0-8d07-1e009f0002b4"}]] has access to resource.
2026-02-06 05:19:09,223 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (API-Job-Executor-22:[ctx-54696ea9, job-166]) (logid:1ba7a022) Complete async job-166, jobStatus: FAILED, resultCode: 431, result: org.apache.cloudstack.api.response.ExceptionResponse/null/{"uuidList":[],"errorcode":"431","errortext":"Unable to delete account [12], because it manages the following project(s): [4]. Please, remove the account from these projects or demote it to a regular project role first."}
```
### What to do about it?
Account should get deleted
Beitragsleitfaden
Rechercherichtung
Beginne mit der in der Protokollausgabe gezeigten deleteAccount API und dem DeleteAccountCmd-Einstiegspunkt und bilde dann die in der Aufgabe beschriebene Bereinigungssequenz für Konto und Projekt nach. Verfolge den Fehler, der meldet, dass das gelöschte Projekt weiterhin vom Konto verwaltet wird. Erledigt ist die Aufgabe, wenn das Konto deaktiviert und gelöscht werden kann, nachdem sein Projekt bei aktivierter Bereinigung entfernt wurde.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- api, backend
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100