Fixing parameterized job invocation
authorRamon van Alteren <ramon@vanalteren.nl>
Tue, 7 Feb 2012 08:55:25 +0000 (09:55 +0100)
committerRamon van Alteren <ramon@vanalteren.nl>
Wed, 8 Feb 2012 14:12:24 +0000 (15:12 +0100)
It will now allow parameterized jobs to be called, with or without security token.
Thanks for RBURHUM for reporting the issue.

jenkinsapi/job.py

index 7adb48036f20f3b1245c227ec23663376e3b7c1c..9588acc650f3b023a03f0dc9a106a6f189e2c2ad 100644 (file)
@@ -32,11 +32,12 @@ class Job(JenkinsBase):
         return self.jenkins
 
     def get_build_triggerurl( self, token=None, params={} ):
-        if token is None:
+        if token is None and not params:
             extra = "build"
         elif params:
-            assert isinstance(token, str ), "token if provided should be a string."
-            params['token'] = token
+            if token:
+                assert isinstance(token, str ), "token if provided should be a string."
+                params['token'] = token
             extra = "buildWithParameters?" + urllib.urlencode(params)
         else:
             assert isinstance(token, str ), "token if provided should be a string."