Hello everyone, I originally posted this on the jenkinsci-dev list<https://groups.google.com/forum/?fromgroups=#!topic/jenkinsci-dev/C-r7uzn-1DA>, but am posting here in hopes that a broader audience might yield more help.
I'm looking for help with writing a groovy script for use with jenkins-cli that can set the ToolInstallation path for a particular slave and tool (I'm trying to script the deployment of a new slave node). In https://wiki.jenkins-ci.org/display/JENKINS/Display+Tools+Location+on+All+Nodes I see how I can enumerate all the tools and their installations but I'm having trouble figuring out what the inverse of ToolInstallation.translateFor() might be. Jesse Glick on the dev list was kind enough to point me to hudson.tools.ToolLocationNodeProperty but the class has no setters, so is the intention that I create a new instance? I don't want to add a location, I want to change the one that's already there, so a new instance doesn't seem like the right thing to do. Even if I have a new instance, I have to set that on something, but the Slave class doesn't seem to have a setter for the properties collection either, so I'm at loss as to how to get my new instance into the Slave's property collection. Also, I don't quite grok the relationship between a property and a descriptor. They seem to both point to collections of each other, and neither has a setter for home so no help there in trying to figure out which one I'm supposed to be dealing with. Not being a Java developer (I work mostly in C++ and Javascript), I'm unfamiliar with the patterns and idioms used by that community and I'm struggling to figure out how all the pieces fit together. I also found NodeProperty.reconfigure(), but have no idea what a StaplerRequest is or where I'd get one from, nor do have the JSONObject that I assume represents the configuration. Is this the route I should be heading down? I think this might actually be intended for use by the web UI and not CLI/Groovy. How can I get the JSON for the current configuration for the slave so I can figure out which part to modify? Does anyone out there have a script that does any manipulation of tool locations for nodes that can be shared? Sorry for the long post and my general newbie-ness with the Jenkins codebase. Any help is greatly appreciated. Matt
