title: Jenkins/Hudson CLI API to modify the node labels using Groovy
body: <p>Does anyone know how to modify the Jenkins/Hudson node labels in a non-manually way? I mean, thorough an API like the CLI API that this tool offers (without restarting Jenkins/Hudson of course).</p>
  
  <p>My guess is that the best option is using a Groovy script to enter into the Jenkins/Hudson guts. Executing something like:</p>
  
  <p>java -jar -s HUDSON_URL:8080 groovy /path/to/groovy.groovy</p>
  
  <p>Being the content of that script something like:</p>
  
  <pre><code>for (aSlave in hudson.model.Hudson.instance.slaves) {
     labels = aSlave.getAssignedLabels()
     println labels
     **aSlave.setLabel("blabla")** // this method doesn't exist, is there any other way???
  }
  </code></pre>
  
  <p>Thanks in advance!</p>
  
  <p>Victor</p>