Fix API breakage caused by OS Plugin version scan
[releng/global-jjb.git] / jenkins-admin / slay_computer.groovy
1 /*****************
2 * Completely slays misbehaving slave nodes
3 *
4 * NOTE: Use del_computer.groovy first! If nodes are still hanging around
5 * _then_ consider using this script. This one is mucking around in a
6 * location we should not normally be touching, however if a slave
7 * refuses to go away (tosses an exception) this _will_ get rid of it.
8 *
9 * NOTE 2: If you have any slaves you want to live through this and you
10 * have them currently marked offline you _must_ bring them back online.
11 *****************/
12
13 import jenkins.*
14 import jenkins.model.*
15 import hudson.*
16 import hudson.model.*
17
18 for (aComputer in Jenkins.instance.computers) {
19     try {
20         println "displayName: " + aComputer.properties.displayName
21         println "offline: " + aComputer.properties.offline
22         println "temporarilyOffline: " + aComputer.properties.temporarilyOffline
23         if (aComputer.properties.offline) {
24             println "Bad node, removing"
25             Jenkins.instance.removeComputer(aComputer)
26         }
27         println ""
28     }
29     catch (NullPointerException nullPointer) {
30         println "NullPointerException caught"
31         println ""
32     }
33 }
34
35 // vim: sw=4 sts=4 ts=4 et ai :