turbaszek commented on a change in pull request #9947:
URL: https://github.com/apache/airflow/pull/9947#discussion_r463925619



##########
File path: airflow/providers/jenkins/operators/jenkins_job_trigger.py
##########
@@ -123,20 +129,20 @@ def build_job(self, jenkins_server):
         """
         # Warning if the parameter is too long, the URL can be longer than
         # the maximum allowed size
-        if self.parameters and isinstance(self.parameters, str):
+        if parameters and isinstance(parameters, str):
             import ast
-            self.parameters = ast.literal_eval(self.parameters)
+            parameters = ast.literal_eval(parameters)
 
-        if not self.parameters:
-            # We need a None to call the non parametrized jenkins api end point
-            self.parameters = None
+        if not parameters:
+            # We need to a None to call the non parametrized jenkins api end 
point
+            parameters = None
 
         request = Request(
             method='POST',
-            url=jenkins_server.build_job_url(self.job_name, self.parameters, 
None))
+            url=jenkins_server.build_job_url(self.job_name, parameters, None))

Review comment:
       I think at this point `parameters` have in fact `Optional[Any]` type due 
to `ast.literal_eval(parameters)` and this is incompatible with type 
`Optional[str]` of `build_job_url`.
   
   Personally I would do:
   ```
   params = ast.literal_eval(parameters) if parameters else None
   url=jenkins_server.build_job_url(self.job_name,  params, None)
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to