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) {
407
407
}
408
408
}
409
409
410
+ getLauncherFactory ().onNodeTerminated ();
411
+
410
412
// Wrap deletion disposables into statistics tracking disposables
411
413
AsyncResourceDisposer .get ().dispose (
412
414
new RecordDisposal (
Original file line number Diff line number Diff line change @@ -97,6 +97,14 @@ public abstract class LauncherFactory extends AbstractDescribableImpl<LauncherFa
97
97
*/
98
98
public abstract @ CheckForNull String isWaitingFor (@ Nonnull JCloudsSlave slave ) throws JCloudsCloud .ProvisioningFailedException ;
99
99
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
+
100
108
/**
101
109
* Launch nodes via ssh-slaves plugin.
102
110
*/
@@ -233,6 +241,14 @@ public static final class JNLP extends LauncherFactory {
233
241
234
242
public static final LauncherFactory JNLP = new JNLP ();
235
243
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
+
236
252
@ DataBoundConstructor // Needed for JCasC
237
253
public JNLP () {}
238
254
@@ -245,7 +261,16 @@ public ComputerLauncher createLauncher(@Nonnull JCloudsSlave slave) throws IOExc
245
261
@ Override
246
262
public @ CheckForNull String isWaitingFor (@ Nonnull JCloudsSlave slave ) {
247
263
// 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 ();
249
274
}
250
275
251
276
@ Override
You can’t perform that action at this time.
0 commit comments