Skip to content

Commit

Permalink
extra condition to check returned object not None (#22608)
Browse files Browse the repository at this point in the history
  • Loading branch information
SasanAhmadi committed Apr 4, 2022
1 parent 5247445 commit c30ab69
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion airflow/providers/jenkins/operators/jenkins_job_trigger.py
Expand Up @@ -158,7 +158,11 @@ def poll_job_in_queue(self, location: str, jenkins_server: Jenkins) -> int:
)
if location_answer is not None:
json_response = json.loads(location_answer['body'])
if 'executable' in json_response and 'number' in json_response['executable']:
if (
'executable' in json_response
and json_response['executable'] is not None
and 'number' in json_response['executable']
):
build_number = json_response['executable']['number']
self.log.info('Job executed on Jenkins side with the build number %s', build_number)
return build_number
Expand Down

0 comments on commit c30ab69

Please sign in to comment.