Joffreybvn opened a new pull request, #31672: URL: https://github.com/apache/airflow/pull/31672
Hello, The JiraOperator fails when using methods that returns any other thing than a dict. This PR fix it by checking whenever a dict is returned. ### Example issue The [`get_project_issues_count` method](https://github.com/atlassian-api/atlassian-python-api/blob/master/atlassian/jira.py#L2650) returns the number of issues in a project, as `int`. ```python JiraOperator( task_id="example", jira_method="get_project_issues_count", jira_conn_id="jira", jira_method_args={"project": "ABC"}, dag=dag, ) ``` However, the [current implementation of the JiraOperator](https://github.com/apache/airflow/blob/main/airflow/providers/atlassian/jira/operators/jira.py#L79) expect a dict as response, to perform a `get` on it. Thus, the above code will fail, throwing the following: ```logs Traceback (most recent call last): File "/opt/app-root/lib64/python3.9/site-packages/airflow/providers/atlassian/jira/operators/jira.py", line 79, in execute output = jira_result.get("id", None) if jira_result is not None else None AttributeError: 'int' object has no attribute 'get' ``` ### Solution Check if it's a dict prior to performing a `get` on the returned value. --- **^ Add meaningful description above** Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information. In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed. In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x). In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments). -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
