|
31 | 31 | import hudson.model.TaskListener; |
32 | 32 | import hudson.model.listeners.ItemListener; |
33 | 33 | import hudson.model.listeners.SaveableListener; |
34 | | -import hudson.security.ACL; |
35 | | -import hudson.security.ACLContext; |
36 | 34 | import hudson.slaves.ComputerListener; |
37 | 35 | import hudson.slaves.EphemeralNode; |
38 | 36 | import io.fabric8.kubernetes.api.model.ContainerStateTerminated; |
|
59 | 57 | import java.util.logging.Level; |
60 | 58 | import java.util.logging.Logger; |
61 | 59 | import jenkins.model.Jenkins; |
| 60 | +import jenkins.util.Listeners; |
62 | 61 | import jenkins.util.Timer; |
63 | 62 | import org.csanchez.jenkins.plugins.kubernetes.KubernetesClientProvider; |
64 | 63 | import org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud; |
@@ -314,7 +313,7 @@ public void eventReceived(Action action, Pod pod) { |
314 | 313 | return; |
315 | 314 | } |
316 | 315 |
|
317 | | - ExtensionList.lookup(Listener.class).forEach(listener -> { // TODO 2.324+ jenkins.util.Listeners |
| 316 | + Listeners.notify(Listener.class, true, listener -> { |
318 | 317 | try { |
319 | 318 | listener.onEvent(action, optionalNode.get(), pod, terminationReasons.get(optionalNode.get().getNodeName())); |
320 | 319 | } catch (Exception x) { |
@@ -420,9 +419,7 @@ public void onEvent(@NonNull Watcher.Action action, @NonNull KubernetesSlave nod |
420 | 419 | } |
421 | 420 | }); |
422 | 421 | logLastLinesThenTerminateNode(node, pod, runListener); |
423 | | - try (ACLContext context = ACL.as(ACL.SYSTEM)) { |
424 | | - PodUtils.cancelQueueItemFor(pod, "ContainerError"); |
425 | | - } |
| 422 | + PodUtils.cancelQueueItemFor(pod, "ContainerError"); |
426 | 423 | } |
427 | 424 | } |
428 | 425 | } |
@@ -486,9 +483,7 @@ public void onEvent(@NonNull Watcher.Action action, @NonNull KubernetesSlave nod |
486 | 483 | } |
487 | 484 | }); |
488 | 485 | terminationReasons.add("ImagePullBackOff"); |
489 | | - try (ACLContext context = ACL.as(ACL.SYSTEM)) { |
490 | | - PodUtils.cancelQueueItemFor(pod, "ImagePullBackOff"); |
491 | | - } |
| 486 | + PodUtils.cancelQueueItemFor(pod, "ImagePullBackOff"); |
492 | 487 | node.terminate(); |
493 | 488 | } |
494 | 489 | } |
|
0 commit comments