File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
plugin/src/main/java/jenkins/plugins/openstack/compute Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -407,6 +407,8 @@ protected void _terminate(TaskListener listener) {
407407 }
408408 }
409409
410+ getLauncherFactory ().onNodeTerminated ();
411+
410412 // Wrap deletion disposables into statistics tracking disposables
411413 AsyncResourceDisposer .get ().dispose (
412414 new RecordDisposal (
Original file line number Diff line number Diff line change @@ -97,6 +97,14 @@ public abstract class LauncherFactory extends AbstractDescribableImpl<LauncherFa
9797 */
9898 public abstract @ CheckForNull String isWaitingFor (@ Nonnull JCloudsSlave slave ) throws JCloudsCloud .ProvisioningFailedException ;
9999
100+ /**
101+ * Callback run when the node is being terminated.
102+ *
103+ * This is before the resources are removed.
104+ */
105+ public void onNodeTerminated () {
106+ }
107+
100108 /**
101109 * Launch nodes via ssh-slaves plugin.
102110 */
@@ -233,6 +241,14 @@ public static final class JNLP extends LauncherFactory {
233241
234242 public static final LauncherFactory JNLP = new JNLP ();
235243
244+ /**
245+ * Track the termination.
246+ *
247+ * This is needed so JNLP#isWaitingFor() reports completion when node is terminated before
248+ * JCloudsSlaveTEmplate#provisionSlave() detects provisioning is completed.
249+ */
250+ private transient boolean terminated = false ;
251+
236252 @ DataBoundConstructor // Needed for JCasC
237253 public JNLP () {}
238254
@@ -245,7 +261,16 @@ public ComputerLauncher createLauncher(@Nonnull JCloudsSlave slave) throws IOExc
245261 @ Override
246262 public @ CheckForNull String isWaitingFor (@ Nonnull JCloudsSlave slave ) {
247263 // The address might not be visible at all so let's just wait for connection.
248- return slave .getChannel () != null ? null : "JNLP connection was not established yet" ;
264+ return terminated || slave .getChannel () != null
265+ ? null
266+ : "JNLP connection was not established yet"
267+ ;
268+ }
269+
270+ @ Override
271+ public void onNodeTerminated () {
272+ terminated = true ;
273+ super .onNodeTerminated ();
249274 }
250275
251276 @ Override
You can’t perform that action at this time.
0 commit comments