Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test on user.identities existence #11

Open
rouxn-bsi opened this issue Oct 16, 2024 · 0 comments
Open

Test on user.identities existence #11

rouxn-bsi opened this issue Oct 16, 2024 · 0 comments

Comments

@rouxn-bsi
Copy link

rouxn-bsi commented Oct 16, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant