Page MenuHomePhabricator

check_user - KeyError: 'relations'
Closed, ResolvedPublic

Description

When using check_user (the script used for https://wikitech.wikimedia.org/wiki/SRE/Clinic_Duty/Access_requests#Verifying_WMF_developer_accounts verifying developer accounts

this can happen:

[cumin1001:~] $ sudo check_user jvargas@wikimedia.org
WikiTech Users:
	Username:	JVargas
	Verified Email:	20220106184544
Traceback (most recent call last):
  File "/usr/local/sbin/check_user", line 182, in <module>
    raise SystemExit(main())
  File "/usr/local/sbin/check_user", line 167, in main
    [r['value'] for r in user['relations'] if r['type'] == 'manager']
KeyError: 'relations'

This was from T298719#7606192 while I had no problem using it at T298766#7606177.

Seems like it errors out if no manager was defined.

Event Timeline

Dzahn updated the task description. (Show Details)

Change 752018 had a related patch set uploaded (by RhinosF1; author: RhinosF1):

[operations/puppet@production] check_user: catch manager being None

https://gerrit.wikimedia.org/r/752018

Dzahn triaged this task as Medium priority.Jan 7 2022, 11:41 PM

Change 752018 merged by Jbond:

[operations/puppet@production] check_user: catch manager being None

https://gerrit.wikimedia.org/r/752018

RhinosF1 claimed this task.

Thanks to @jbond for merge.