[2.x] Unable to delete a user via CLI

Bug #1724096 reported by Dmitrii Shcherbakov
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Blake Rouse
2.6
Fix Released
High
Blake Rouse

Bug Description

Unable to delete an admin user from MAAS (note: initial setup screen has not been passed yet)

$ maas admin user delete maas -d
500 INTERNAL SERVER ERROR

       Content-Type: text/plain; charset=utf-8
               Date: Mon, 16 Oct 2017 22:44:56 GMT
             Server: TwistedWeb/16.0.0
             Status: 500
  Transfer-Encoding: chunked
               Vary: Cookie
    X-Frame-Options: SAMEORIGIN

relation "django_admin_log" does not exist
LINE 1: DELETE FROM "django_admin_log" WHERE "django_admin_log"."use...
                    ^
$ maas -h
usage: maas [-h] COMMAND ...

optional arguments:
  -h, --help show this help message and exit

drill down:
  COMMAND
    refresh Refresh the API descriptions of all profiles.
    login Log in to a remote API, and remember its description and
              credentials.
    list List remote APIs that have been logged-in to.
    logout Log out of a remote API, purging any stored credentials.
    admin Interact with http://10.30.20.21/MAAS/api/2.0/
    maas Interact with http://10.30.20.21/MAAS/api/2.0/

http://maas.io/

dpkg -l '*maas*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===================================================-==============================-==============================-============================================================================================================
un maas <none> <none> (no description available)
ii maas-cli 2.2.2-6099-g8751f91-0ubuntu1~1 all MAAS client and command-line interface
un maas-cluster-controller <none> <none> (no description available)
ii maas-common 2.2.2-6099-g8751f91-0ubuntu1~1 all MAAS server common files
ii maas-dhcp 2.2.2-6099-g8751f91-0ubuntu1~1 all MAAS DHCP server
ii maas-dns 2.2.2-6099-g8751f91-0ubuntu1~1 all MAAS DNS server
ii maas-proxy 2.2.2-6099-g8751f91-0ubuntu1~1 all MAAS Caching Proxy
ii maas-rack-controller 2.2.2-6099-g8751f91-0ubuntu1~1 all Rack Controller for MAAS
ii maas-region-api 2.2.2-6099-g8751f91-0ubuntu1~1 all Region controller API service for MAAS
ii maas-region-controller 2.2.2-6099-g8751f91-0ubuntu1~1 all Region Controller for MAAS
un maas-region-controller-min <none> <none> (no description available)
un python-django-maas <none> <none> (no description available)
un python-maas-client <none> <none> (no description available)
un python-maas-provisioningserver <none> <none> (no description available)
ii python3-django-maas 2.2.2-6099-g8751f91-0ubuntu1~1 all MAAS server Django web framework (Python 3)
ii python3-maas-client 2.2.2-6099-g8751f91-0ubuntu1~1 all MAAS python API client (Python 3)
ii python3-maas-provisioningserver 2.2.2-6099-g8751f91-0ubuntu1~1 all MAAS server provisioning libraries (Python 3)

Tags: cpe-onsite

Related branches

Changed in maas:
milestone: none → 2.3.0beta3
importance: Undecided → High
status: New → Triaged
summary: - Unable to delete a user via CLI
+ [2.x] Unable to delete a user via CLI
Changed in maas:
assignee: nobody → Björn Tillenius (bjornt)
assignee: Björn Tillenius (bjornt) → nobody
Revision history for this message
Andres Rodriguez (andreserl) wrote :

@Dimitrii,

Are there any deployed machines that this user owns or are there any IP addresses allocated to this user?

Changed in maas:
status: Triaged → Incomplete
Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :

It was a fresh user and fresh env - the first login screen was not passed yet at that point.

I was able to reproduce it multiple times in a row.

Changed in maas:
assignee: nobody → Alberto Donato (ack)
Changed in maas:
status: Incomplete → Triaged
Revision history for this message
Alberto Donato (ack) wrote :

@dimitriis could you please provide the exact steps you took prior to running the user remove API call?

Changed in maas:
status: Triaged → Incomplete
Changed in maas:
milestone: 2.3.0beta3 → 2.3.0rc1
Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :

I will try to reproduce it although the original environment is gone now.

Changed in maas:
milestone: 2.3.0rc1 → 2.3.0rc2
milestone: 2.3.0rc2 → 2.3.0rc1
milestone: 2.3.0rc1 → 2.3.0rc2
Changed in maas:
milestone: 2.3.0rc2 → 2.3.0
Changed in maas:
milestone: 2.3.0 → 2.3.x
Revision history for this message
Michael Skalka (mskalka) wrote :

Alberto,

Ran into this bug today as well. Created a superuser via the CLI, then tried to delete it with another super user via the GUI. I initially thought it was due to the fact that I had never logged in with the deleted user (no login, no logs?) but that turned out to be false. The GUI error is the same as above, just rendered in html:

ProgrammingError at /accounts/tmadmin/del/
relation "django_admin_log" does not exist
LINE 1: DELETE FROM "django_admin_log" WHERE "django_admin_log"."use...
                    ^
Request Method: POST
Request URL: http://10.X.X.X/MAAS/accounts/tmadmin/del/
Django Version: 1.8.7
Exception Type: ProgrammingError
Exception Value:
relation "django_admin_log" does not exist
LINE 1: DELETE FROM "django_admin_log" WHERE "django_admin_log"."use...
                    ^
Exception Location: /usr/lib/python3/dist-packages/django/db/backends/utils.py in execute, line 64
Python Executable: /usr/bin/python3
Python Version: 3.5.2
Python Path:
['/',
 '/usr/bin',
 '/usr/lib/python35.zip',
 '/usr/lib/python3.5',
 '/usr/lib/python3.5/plat-x86_64-linux-gnu',
 '/usr/lib/python3.5/lib-dynload',
 '/usr/local/lib/python3.5/dist-packages',
 '/usr/lib/python3/dist-packages']
Server time: Wed, 31 Jan 2018 15:57:19 +0000

Revision history for this message
Andres Rodriguez (andreserl) wrote :

Hi!

**This is an automated message**

We believe this is may no longer be an issue in the latest MAAS release. Due to the original date of the bug report, we are currently marking it as Invalid. If you believe this bug report still valid against the latest release of MAAS, or if you are still interested in this, please re-open this bug report.

Thanks

Changed in maas:
status: Incomplete → Invalid
Revision history for this message
Vladimir Grevtsev (vlgrevtsev) wrote :

Hi all,

Reproduced today, MAAS version: 2.3.5 (6511-gf466fdb-0ubuntu1), Xenial (tried to delete a user via both GUI and CLI)

Traceback: https://paste.ubuntu.com/p/cpRQczP6tr/
Same via CLI: https://paste.ubuntu.com/p/HpC4G8j998/
Packages installed: https://paste.ubuntu.com/p/fCM5Y3vSYV/

Changed in maas:
status: Invalid → Confirmed
tags: added: cpe-onsite
Revision history for this message
Alberto Donato (ack) wrote :

Hi Vladimir, do you have DEBUG enabled in maas? The error seems related to the django admin module, which is only enabled when debug is enabled.

If you do, you might need to run "maas migrate" to have maas create the necessary tables.

Alberto Donato (ack)
Changed in maas:
status: Confirmed → Incomplete
Revision history for this message
Jose Delarosa (jdelaros1) wrote :

Also found in v2.4.2. Adding a "debug: true" or "debug:false" entry in /etc/maas/regiond.conf triggers it. Removing it prevents it.

Running "maas-region migrate" solves it. Why is this behavior and is it documented somewhere?

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :

Moved to "New" because of comment #9

Changed in maas:
status: Incomplete → New
Revision history for this message
Blake Rouse (blake-rouse) wrote :

The issue is that debug: true is enabling django admin which it should not do.

Changed in maas:
status: New → In Progress
assignee: Alberto Donato (ack) → Blake Rouse (blake-rouse)
milestone: 2.3.x → 2.7.0alpha1
Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
status: Fix Committed → Fix Released
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.