Got it. Thx.

On Wed, Nov 12, 2014 at 3:36 PM, Robert Sandell <[email protected]>
wrote:

> Similar to
>
> https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java#L290
>
> But unless you'll be running the script on multiple masters you could just
> hard code the id into the script if you are using the same credential to
> connect all the slaves.
>
> /B
>
> On Wed, Nov 12, 2014 at 8:05 AM, munsingh <[email protected]> wrote:
>
>> Any idea on how to get the credentialsId programmatically?
>>
>> -Manish
>>
>> On Tuesday, 11 November 2014 00:09:25 UTC+5:30, Robert Sandell wrote:
>>>
>>> Well It "works on my machine (TM)"
>>>
>>>   println(hudson.plugins.sshslaves.SSHLauncher.class.getName())
>>>
>>> provides an output without an error. Try that.
>>> It could be mistaking the error from that there is no known constructor
>>> that only takes three arguments from what I can see?
>>>
>>> /B
>>>
>>> On Mon, Nov 10, 2014 at 12:28 PM, munsingh <[email protected]> wrote:
>>>
>>>> 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.
>>>>
>>>
>>>
>>>
>>> --
>>> 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.
>>
>
>
>
> --
> Robert Sandell
> *Software Engineer*
> *CloudBees Inc.*
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jenkinsci-dev/JRu4R9bKibU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
May the force be with you

-- 
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.

Reply via email to