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

Terminate the EC2 on receiving an exception #952

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/hudson/plugins/ec2/ssh/EC2UnixLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@
int exitStatus = waitCompletion(sess);
if (exitStatus != 0) {
logWarning(computer, listener, "init script failed: exit code=" + exitStatus);
return;
sess.close();
Copy link
Contributor

Choose a reason for hiding this comment

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

This will clearly not close the sess object if the script is successful, you probably should hoist this above the if.

throw new IOException("Init script exited with an error: exit code=" + exitStatus);

Check warning on line 214 in src/main/java/hudson/plugins/ec2/ssh/EC2UnixLauncher.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 214 is not covered by tests
}
sess.close();

logInfo(computer, listener, "Creating ~/.hudson-run-init");

Expand Down
Loading