-
Notifications
You must be signed in to change notification settings - Fork 690
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
Handle cases where SlaveTemplate has been removed #429
Conversation
@@ -411,9 +416,9 @@ public boolean verifyServerHostKey(String hostname, int port, String serverHostK | |||
} | |||
} | |||
|
|||
private String getEC2HostAddress(EC2Computer computer) throws InterruptedException { | |||
private static String getEC2HostAddress(EC2Computer computer, SlaveTemplate template) throws InterruptedException { |
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.
Why static? I cannot see when it's needed
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 changed it to static because it doesn't need any value in the actual class itself so it should have been static from the start as its not required to be tied to any instance of the Launcher
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.
your words make sense, but it looks weird to me having a static private method which is not called within a static block of code. Anyway, I'm not blocking the PR because of this. It's just a matter of taste and I only wanted to know if there were other reasons. I will let the others give their opinion if applies and I'm approving the PR.
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.
Ahh for me I used to mostly write C++, so a static method has the benefit of not passing in an additional parameter(The this pointer). So the habit stayed with me.
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.
Code looks good
@@ -411,9 +416,9 @@ public boolean verifyServerHostKey(String hostname, int port, String serverHostK | |||
} | |||
} | |||
|
|||
private String getEC2HostAddress(EC2Computer computer) throws InterruptedException { | |||
private static String getEC2HostAddress(EC2Computer computer, SlaveTemplate template) throws InterruptedException { |
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.
your words make sense, but it looks weird to me having a static private method which is not called within a static block of code. Anyway, I'm not blocking the PR because of this. It's just a matter of taste and I only wanted to know if there were other reasons. I will let the others give their opinion if applies and I'm approving the PR.
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.
LGTM. The use of IOException
could potentially be replaced with something more specific, though I can't think of anything besides maybe IllegalStateException
.
Can't use IllegalState as its not caught outside and does not terminate the instance. It might also lead to a FD leak scenario(which seems to be a bug in core) |
If there are no objections to merging it as is, I will be merging tomorrow |
Recently we encoutered an issue where when a SlaveTemplate is removed but an old Instance that uses this slave template still exists it will throw an NPE.
This PR annotates the methods and reworks the code to handle such scenarios more gracefully.