maas init doesn't check if the user or email already exists
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Committed
|
Medium
|
Jacopo Rota |
Bug Description
Hi,
Using Ubuntu 18.04, MAAS 2.4.2-7034-
I ran "sudo maas init" once, and thought I could paste an actual key in the "Import SSH keys [] (lp:user-id or gh:user-id):" prompt. Apparently I can't, so "maas init" exited with "SSHKeysError: The input entered is not in a correct format. Your SSH keys will not be imported."
I thought user creation just failed, so I tried again with the same user/email, but without putting anything in the SSH key prompt, and all I got was a traceback (see below).
"maas init" should check for user existence.
"maas init" should be a bit more clear that you can't paste a key
"maas init" should offer importing ~/.ssh/*.pub keys, I feel.
Thanks !
$ sudo maas init
Create first admin account:
Username: root
Password:
Again:
Email: <email address hidden>
Import SSH keys [] (lp:user-id or gh:user-id):
Traceback (most recent call last):
File "/usr/lib/
return self.cursor.
psycopg2.
DETAIL: Key (email)=(<email address hidden>) already exists.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/sbin/
main()
File "/usr/sbin/
run()
File "/usr/sbin/
management.
File "/usr/lib/
utility.
File "/usr/lib/
self.
File "/usr/lib/
self.
File "/usr/lib/
output = self.handle(*args, **options)
File "/usr/lib/
username, email=email, password=password)
File "/usr/lib/
return self._create_
File "/usr/lib/
user.
File "/usr/lib/
super(
File "/usr/lib/
force_
File "/usr/lib/
updated = self._save_
File "/usr/lib/
result = self._do_
File "/usr/lib/
using=using, raw=raw)
File "/usr/lib/
return getattr(
File "/usr/lib/
return query.get_
File "/usr/lib/
cursor.
File "/usr/lib/
return self.cursor.
File "/usr/lib/
six.
File "/usr/lib/
raise value.with_
File "/usr/lib/
return self.cursor.
django.
DETAIL: Key (email)=(<email address hidden>) already exists.
Related branches
- Alexsander de Souza: Approve
- MAAS Lander: Approve
- Jacopo Rota: Pending requested
-
Diff: 237 lines (+71/-28)4 files modifiedsrc/maasserver/management/commands/createadmin.py (+32/-22)
src/maasserver/models/keysource.py (+6/-2)
src/maasserver/tests/test_commands.py (+28/-0)
src/maasserver/utils/keys.py (+5/-4)
Changed in maas: | |
status: | New → Triaged |
importance: | Undecided → Medium |
milestone: | none → 2.6.0 |
Changed in maas: | |
milestone: | 2.6.0 → 3.4.0 |
Changed in maas: | |
assignee: | nobody → Jacopo Rota (r00ta) |
Changed in maas: | |
status: | Triaged → Fix Committed |
Changed in maas: | |
milestone: | 3.4.0 → 3.4.0-beta2 |
Hi,
Met the exact same issue here with the same Ubuntu and MaaS version.
I tried to import ssh key from launchpad but input a wrong lh account. The import failed obviously.
But when I try to import again with the correct account, `maas init` gives me the same error as above.