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

beaker-refresh-ldap fails - user lacks email addr #243

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

cbouchar
Copy link
Contributor

@cbouchar cbouchar commented Dec 4, 2024

Some Beaker installations learns user via ldap groups. One user did not have an email address resulting in beaker-refresh-ldap raising an exception:
KeyError: 'mail'. Offending line is here:
File "/usr/lib/python2.7/site-packages/bkr/server/model/identity.py",
line 301, in by_user_name
user.email_address = attrs['mail'][0].decode('utf8')
KeyError: 'mail'
When this exception is encountered, beaker-refresh-ldap stops learning other users. Fix: When missing any required key attributes (Mail, uid, cn), the user will not be returned and as a result will not be learned without raising an exception. This allows beaker-refresh-ldap to continue learning other users.

Copy link
Contributor

@p3ck p3ck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link

@jchristi jchristi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits.

Copy link
Collaborator

@JohnVillalovos JohnVillalovos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cbouchar . This looks good to me.

@JohnVillalovos
Copy link
Collaborator

I'm scared that based on those test failures that GitHub may have finally killed support for being able to run CentOS 7 😱

Some Beaker installations learns user via ldap groups.  One user
did not have an email address resulting in beaker-refresh-ldap
raising an exception:
KeyError: 'mail'. Offending line is here:
  File "/usr/lib/python2.7/site-packages/bkr/server/model/identity.py",
       line 301, in by_user_name
    user.email_address = attrs['mail'][0].decode('utf8')
KeyError: 'mail'
When this exception is encountered, beaker-refresh-ldap stops learning other users.
Fix: When missing any required key attributes (Mail, uid, cn), the user will
not be returned and as a result will not be learned without raising an exception.
This allows beaker-refresh-ldap to continue learning other users.
Copy link
Collaborator

@JohnVillalovos JohnVillalovos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cbouchar

I approve 👍

Copy link

@jchristi jchristi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@cbouchar cbouchar merged commit 5a3c723 into beaker-project:python-3 Dec 10, 2024
12 of 19 checks passed
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

Successfully merging this pull request may close these issues.

4 participants