Page MenuHomePhabricator

Make it possible to rename users in Gerrit
Closed, DeclinedPublic

Description

A bunch of people have already requested this from me, but I just haven't gotten around to it yet.

It's not as hard as originally thought--what we'll want to do is rename in LDAP (using labsconsole), then have something that updates the gerrit db. There's only two tables needing updating:

accounts -> full_name
account_external_ids => external_id

The two queries are:
update accounts set full_name = "New Name" where full_name = "Old Name"
update account_external_ids set external_id = "gerrit:New Name" where external_id = "gerrit:Old Name"

For the account_external_ids, Old Name may not be the same capitalization as accounts...login is case-insensitive and was stored based on initial login (afaict).

Probably won't get to this immediately, but should only take half a day to whip up an SSH plugin for gerrit 2.5 that labsconsole can call to rename the user in gerrit.

(Note: the "official" suggestion for this right now is to rename in LDAP, login as the new user, then "merge" the two accounts. This is messy and way more error-prone than my new idea :p)


Version: unspecified
Severity: normal

Details

Reference
bz40061

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:08 AM
bzimport added a project: Gerrit.
bzimport set Reference to bz40061.
bzimport added a subscriber: Unknown Object (MLST).

(In reply to comment #0)

Probably won't get to this immediately, but should only take half a day to whip
up an SSH plugin for Gerrit change #2.5 that labsconsole can call to rename the user
in gerrit.

That's gerrit version 2.5. Really need to adjust that regex...

What we should probably do is have Gerrit pull the full name you provide in labsconsole (so you can edit it in one place).

jgonera wrote:

Ideally yes, I was just suggesting a partial fix for now.

If for some reason name is not set, "git review -d (number)" does not work[1]:

$ git review -d 37771
Traceback (most recent call last):

File "/usr/local/bin/git-review", line 863, in <module>
  main()
File "/usr/local/bin/git-review", line 801, in main
  print_exit_message(download_review(options.download, branch, remote),
File "/usr/local/bin/git-review", line 643, in download_review
  author = re.sub('\W+', '_', review_info['owner']['name']).lower()

KeyError: 'name'

[1] https://gerrit.wikimedia.org/r/#/c/37771/

Removing patch-in-gerrit keyword--that's just a fix to git-review being bad, and isn't what this bug is about.

OK, this is definitely possible now (I know since I've had my name changed), but it's apparently still a manual process. Should we close this bug or keep it opened until everything is ironed out?

If someone managed to get its name changed, I guess we have some howto/process to achieve. If so, that would let us close this bug :-] Then we can probably announce that possibilities to our users, I guess a bunch of would want a rename.

Does anyone want to do anything else with this or can we call it FIXED?

(In reply to Bartosz Dziewoński from comment #11)

Does anyone want to do anything else with this or can we call it FIXED?

No reply => Assuming this can be called FIXED.

Given that the recommendation is (or, at least for me, it was) to create a new account instead of renaming an existing one, I assume WONTFIX is a more precise resolution for this bug.