-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
[FIXED JENKINS-41987] Check for null return values from InstanceIdentityProvider methods #2749
[FIXED JENKINS-41987] Check for null return values from InstanceIdentityProvider methods #2749
Conversation
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.
The change itself looks good to me though maybe there should be more info in the error message.
@jglick Could you please create a JIRA issue? Since JNLP4 is going to be enabled by default in the next LTS, so this fix likely deserves backporting.
@@ -101,7 +101,13 @@ | |||
public JnlpSlaveAgentProtocol4() throws KeyStoreException, KeyManagementException, IOException { | |||
// prepare our local identity and certificate | |||
X509Certificate identityCertificate = InstanceIdentityProvider.RSA.getCertificate(); | |||
if (identityCertificate == null) { | |||
throw new KeyStoreException("no X509Certificate found; perhaps instance-identity is missing or too old"); |
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.
Maybe it should explicitly mention the protocol. Just to make the error more diagnosable
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.
JnlpSlaveAgentProtocol4
? The error message will clearly include that already.
RSAPrivateKey privateKey = InstanceIdentityProvider.RSA.getPrivateKey(); | ||
if (privateKey == null) { | ||
throw new KeyStoreException("no RSAPrivateKey found; perhaps instance-identity is missing or too old"); |
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.
instance-identity module
Backporting seems like overkill to me, since this is merely better diagnostic reporting, but as you like. |
🐝 |
see also #7514 |
JENKINS-41987
Otherwise you get a cryptic error when
instance-identity
is misconfigured, for example in tests. This fixes the instantiation error to clearly reflect the actual problem.@reviewbybees