-
Notifications
You must be signed in to change notification settings - Fork 118
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
Check for None before decoding alt subject name #1606
Conversation
Can one of the admins verify this patch? |
bot, okay to test ok to test |
python-rhsm/src/rhsm/certificate2.py
Outdated
@@ -118,7 +118,8 @@ def _create_v1_cert(self, version, extensions, x509, path): | |||
return self._create_v1_prod_cert(version, extensions, x509, path) | |||
|
|||
def _read_alt_name(self, x509): | |||
return x509.get_extension(name='subjectAltName').decode('utf-8') | |||
alt_name = x509.get_extension(name='subjectAltName') | |||
return alt_name if alt_name is None else alt_name.decode('utf-8') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How un-pythonic... How about:
if alt_name is None:
return None
else:
return alt_name.decode('utf-8')
or similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @kahowell. I prefer to avoid Python's ersatz ternary operator.
Damn, I should read properly an remember what others do: #1608 |
@jirihnidek Your change looks better. I'll close this out. |
Looks like when F25 upgraded from python-rhsm 1.19.0 to 1.19.4, our tests started failing:
Looks like the following change was introduced in that timeframe:
candlepin/python-rhsm@f3164e3#diff-b89afd85b4d5ab2767749c609cab6374R118
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1445511