Skip to content

Test on user.identities existence #11

@ghost

Description

Hi/Bonjour @MrBE4R,

Thank you/Merci beaucoup for the script.

I think we should add a test on the user.identities existence to avoid the following error (with the root account for example)
image

if user.identities and len(user.identities) > 0 and 'extern_uid' in user.identities[0]:
    gitlab_group['members'].append({
        'username': user.username,
        'name': user.name,
        'identities': user.identities[0]['extern_uid'],
       'email': user.email
   })
else:
   print(f"User {user.username} does not have a valid 'extern_uid' in identities.")

Here an execution with the additional test:
image

Thank you again!

Cheers,
Nicolas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions