← Back to team overview

python-jenkins-developers team mailing list archive

[Merge] lp:~tully.foote/python-jenkins/new_features into lp:python-jenkins

 

James Page has proposed merging lp:~tully.foote/python-jenkins/new_features into lp:python-jenkins.

Requested reviews:
  Python Jenkins Developers (python-jenkins-developers)
Related bugs:
  Bug #987591 in Python Jenkins: "Add support for alternative node launchers, such as SSH"
  https://bugs.launchpad.net/python-jenkins/+bug/987591

For more details, see:
https://code.launchpad.net/~tully.foote/python-jenkins/new_features/+merge/106214
-- 
https://code.launchpad.net/~tully.foote/python-jenkins/new_features/+merge/106214
Your team Python Jenkins Developers is requested to review the proposed merge of lp:~tully.foote/python-jenkins/new_features into lp:python-jenkins.
=== modified file 'jenkins/__init__.py'
--- jenkins/__init__.py	2012-05-17 15:10:00 +0000
+++ jenkins/__init__.py	2012-05-17 15:43:26 +0000
@@ -421,7 +421,7 @@
 
 
     def create_node(self, name, numExecutors=2, nodeDescription=None,
-                    remoteFS='/var/lib/jenkins', labels=None, exclusive=False):
+                    remoteFS='/var/lib/jenkins', labels=None, exclusive=False, launcher = None):
         '''
         :param name: name of node to create, ``str``
         :param numExecutors: number of executors for node, ``int``
@@ -429,6 +429,7 @@
         :param remoteFS: Remote filesystem location to use, ``str``
         :param labels: Labels to associate with node, ``str``
         :param exclusive: Use this node for tied jobs only, ``bool``
+        :param launcher: Pass in launcher parameters, ``dict``
         '''
         if self.node_exists(name):
             raise JenkinsException('node[%s] already exists'%(name))
@@ -437,6 +438,12 @@
         if exclusive:
             mode = 'EXCLUSIVE'
 
+        # Default launcher
+        if not launcher:
+            launcher = { 'stapler-class' : 'hudson.slaves.JNLPLauncher' }
+            # Example SSH Launcher  {"stapler-class": "hudson.plugins.sshslaves.SSHLauncher", "host": '10.0.0.1', "username": "", "password": "", "privatekey": "", "port": "22", "jvmOptions": ""}
+
+            
         params = {
             'name' : name,
             'type' : NODE_TYPE,
@@ -450,7 +457,7 @@
                 'type'            : NODE_TYPE,
                 'retentionStrategy' : { 'stapler-class'  : 'hudson.slaves.RetentionStrategy$Always' },
                 'nodeProperties'    : { 'stapler-class-bag' : 'true' },
-                'launcher'          : { 'stapler-class' : 'hudson.slaves.JNLPLauncher' }
+                'launcher'          : launcher
             })
         }