Conversation
…Key, return None instead of raising
terc1997
requested changes
Sep 21, 2026
terc1997
left a comment
Contributor
There was a problem hiding this comment.
I liked the approach, however return None for both exceptions can hide bugs since everything else in Requests also returns None. Instead of returning None I have two proposals:
- Unpack two returns. One to identify if it was valid or not and another to specify if the failure was due to SSL.
- Return
Nonefor SSL and raise for everything else inRequests. We're saying that the SSL error is acceptable and can be a warning and everything else needs to be checked, which complies with what we had before and add just the warning layer around SSL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes
validateIBMEntitlementKey()re-raising network exceptions to its caller, which forced the CLI layer to handle low-level network exceptions directly.Changes
src/mas/devops/utils.pyvalidateIBMEntitlementKey()previously caughtrequests.exceptions.RequestExceptionand re-raised it — now catchesrequests.exceptions.SSLErrorspecifically and returnsNone, and catches all otherrequests.exceptions.RequestExceptionand returnsNoneinstead of re-raisingbooltoTrue/False/Nonein docstringRaises:section from docstring — the function no longer raisesReturn value contract:
TrueFalseNoneTesting
Reproduced both scenarios manually inside the MAS CLI container.
Case 1 — SSL error (corporate proxy / self-signed certificate)
Result:
Warning: SSL certificate verification failed — could not reach cp.icr.iowith explanation that the key may still be valid and options to try again / continue / quitCase 2 — Wrong entitlement key
Result:
Warning: IBM entitlement key validation failedwith options to try again / continue / quitLinked issue
Fixes MASCORE-16263
ibm-mas/cli#2519