That's not what I'm looking for : I need the node that will run the polling process, and was passed as Launcher to SCM polling
2012/12/6 Bruno P. Kinoshita <brunodepau...@yahoo.com.br> > Hi Nicolas! > > I *think* when you set executors=0 in the master it is not inserted in the > computers list. Thus the NPE. > > However, if you try to set executors=0 in a slave you will get an error. > > So I think we can assume that whenever you Computer.currentComputer() > returning null, you have a master with 0 executors? > > So maybe you can try the following code: > > --- > Computer computer = Computer.currentComputer(); > if(computer == null) > computer = Jenkins.getInstance().createComputer(); // Calls new > Hudson.MasterComputer() > Node node = computer.getNode(); > --- > > Not the most elegant solution, but hopefully it will give you some > direction to follow, or someone else will chime in with a better > alternative. Just my 0.02 cents :) > > Cheers > Bruno P. Kinoshita > http://kinoshita.eti.br > http://tupilabs.com > > > >________________________________ > > From: nicolas de loof <nicolas.del...@gmail.com> > >To: jenkinsci-dev@googlegroups.com > >Sent: Thursday, December 6, 2012 9:01 AM > >Subject: howto retrieve node from Launcher ? > > > > > >I need the current node to resolve NodeSpecific ToolInstallation during > SCM polling > >(clearcase, working on JENKINS-14247) > > > > > >clearcase plugin uses Computer.currentComputer().getNode(), and fall into > a NullPointer when master is configure to have 0 executors > >currentComputer javadoc says "This method only works when called during a > build", so it probably don't make sense to use it during polling. > > > > > >SCM#calcRevisionsFromBuild give me a Launcher > >"Abstraction of the machine where the polling will take place" > >but Launcher.getComputer is deprecated and unsafe according to javadoc to > retrieve the node > >anyway it seems to work in this case, > >any better suggestion ? > > > > > > > > >