Ok I got it working. I was trying to execute my script as part of a job via the Execute System Groovy Script->Groovy Command option. The Check-Syntax was unable to check the syntax as it was unable to find the SSHSlaves class. However it was working when running the job.
This could be a bug in the Check Syntax functionality, wherein it is unable to look classes from plugins. So a big Thanks Robert!! Much appreciated. On Monday, 10 November 2014 16:27:55 UTC+5:30, munsingh wrote: > > Ok. I tried creating an instance of SSHLauncher class in my script and > imported the plugins as follows: > > import hudson.plugins.sshslaves.*; > > And I try to instantiate the SSHLauncher object by calling: > new SSHLauncher( "172.16.222.142", "22", "jenkins" ) > > however I get the error: > > startup failed: > Script1.groovy: 40: unable to resolve class SSHLauncher > @ line 40, column 62. > indows ? new JNLPLauncher() : new SSHLau > > Looks like it is unable to find the SSHLauncher class. Am I missing > something here? > > Thanks for your help. > > Regards, > Manish > > On Monday, 10 November 2014 16:06:04 UTC+5:30, Robert Sandell wrote: >> >> Yes, the groovy script console should have access to all classes in >> Jenkins including plugin classes. >> >> On Mon, Nov 10, 2014 at 6:51 AM, munsingh <[email protected]> wrote: >> >>> Thanks Robert. >>> >>> QQ: How do I instantiate this class via groovy script, can I import this >>> class in groovy and use it? >>> >>> Regards, >>> Manish >>> >>> >>> On Friday, 7 November 2014 16:16:45 UTC+5:30, munsingh wrote: >>>> >>>> Hello Jenkins Developers, >>>> >>>> I need to create Jenkins Linux Slaves via script. I have been able to >>>> create Windows Slaves, which connect via JNLP by using the folowing code: >>>> >>>> Jenkins.instance.addNode( new DumbSlave(strSlaveName, >>>> strSlaveDescription, >>>> strWorkspace, >>>> strSlaveNumExecutors, >>>> Node.Mode.NORMAL, >>>> strLabel, >>>> "true" == strSlaveIsWindows ? >>>> new JNLPLauncher() : new CommandLauncher( "172.16.222.151 root" ), >>>> new RetentionStrategy.Always(), >>>> new LinkedList())); >>>> >>>> >>>> However I am unable to create Linux Slaves, which "Launch Slave agents >>>> on Unix machines via ssh. The CommandLauncher class creates a slave, which >>>> "Launch Slave agents via execution of command via the master". >>>> I see that the ComputerLauncher class has three sub-classes: >>>> CommandLauncher, ComputerLauncherFilter, DelegatingComputerLauncher, >>>> JNLPLauncher. >>>> >>>> I am not sure whether the ComputerLauncherFilter or the >>>> DelegatingComputerLauncher class needs to be used. >>>> >>>> Any help is highly appreciated. >>>> >>>> Thanks, >>>> Manish >>>> >>>> >>>> >>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Jenkins Developers" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Robert Sandell >> *Software Engineer* >> *CloudBees Inc.* >> > -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
