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

[FIXED JENKINS-41987] Check for null return values from InstanceIdentityProvider methods #2749

Merged
merged 2 commits into from
Feb 17, 2017

Conversation

jglick
Copy link
Member

@jglick jglick commented Feb 13, 2017

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

Copy link
Member

@oleg-nenashev oleg-nenashev left a 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");
Copy link
Member

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

Copy link
Member Author

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");
Copy link
Member

Choose a reason for hiding this comment

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

instance-identity module

@oleg-nenashev oleg-nenashev added needs-jira-issue A JIRA issue should be created for this PR. It is usually needed for the LTS backporting process needs-more-reviews Complex change, which would benefit from more eyes labels Feb 13, 2017
@jglick
Copy link
Member Author

jglick commented Feb 13, 2017

Backporting seems like overkill to me, since this is merely better diagnostic reporting, but as you like.

@jglick jglick changed the title Check for null return values from InstanceIdentityProvider methods [FIXED JENKINS-41987] Check for null return values from InstanceIdentityProvider methods Feb 13, 2017
@jglick jglick removed the needs-jira-issue A JIRA issue should be created for this PR. It is usually needed for the LTS backporting process label Feb 13, 2017
@oleg-nenashev
Copy link
Member

🐝

@jglick jglick added ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback and removed needs-more-reviews Complex change, which would benefit from more eyes labels Feb 14, 2017
@jglick jglick merged commit 2f92482 into jenkinsci:master Feb 17, 2017
@jglick jglick deleted the JnlpSlaveAgentProtocol4-robustness branch February 17, 2017 20:51
@jglick
Copy link
Member Author

jglick commented Mar 3, 2023

see also #7514

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants