FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 777d796e authored by Robin Goodall's avatar Robin Goodall :speech_balloon:
Browse files

missing orgUnitPath sanity check

parent 8a1b02aa
No related branches found
No related tags found
1 merge request!5Retry API requests when a HTTP 503 "Service unavaliable" is received
Pipeline #9189 passed with warnings
......@@ -124,6 +124,17 @@ def sync(configuration, *, read_only=True):
LOG.info(
'Ignoring users whose organization unit path matches %r',
sync_config.ignore_google_org_unit_path_regex)
# Check that all users have an orgUnitPath
missing_org = [
u for u in all_google_users if 'orgUnitPath' not in u
]
if len(missing_org) != 0:
LOG.error('User entries missing orgUnitPath: %s (starting with %s)',
len(missing_org),
missing_org[0]['primaryEmail'] if 'primaryEmail' in missing_org[0]
else 'user with blank email')
raise RuntimeError('Sanity check failed: at least one user is missing orgUnitPath')
# Remove users matching regex
regex = re.compile(sync_config.ignore_google_org_unit_path_regex)
all_google_users = [
u for u in all_google_users if not regex.match(u['orgUnitPath'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment