title: how to modify/add/delete tool installations on a Jenkins slave using Groovy?
body: <p>atm I am using a Groovy script to configure our different Jenkins masters, including the tool installations, eg:</p>
  
  <pre><code>mavenDesc = Jenkins.instance.getDescriptorByName("hudson.tasks.Maven");
  if (mavenDesc != null) {
    MavenInstallation mi = new MavenInstallation("maven3.0.2", "/home/jenkins/apache-maven-3.0.2");
    MavenInstallation mi32 = new MavenInstallation("maven3.2.3", "/home/jenkins/apache-maven-3.2.3");
    mavenDesc.setInstallations(mi, mi32);
  }
  </code></pre>
  
  <p>This works fine but now I want to do the same for the slaves (different OS so different locations). Can't figure out how though...this is the furthest I have gotten:</p>
  
  <pre><code>for (aSlave in jenkins.slaves) {
    for ( ToolLocationNodeProperty.ToolLocation toolLocation : aSlave.getNodeProperties().get(ToolLocationNodeProperty.class).getLocations()) {
      //println(toolLocation.getKey())    
      //println(toolLocation.getType())
      println(toolLocation.getName())
      println(toolLocation.getHome())
    }
  }
  </code></pre>
  
  <p>All instances seem immutable though and I don't seem to find any way to add a Tool location to a slave.</p>
  
  <p>Any ideas?</p>