Adityamalik123 commented on code in PR #27633:
URL: https://github.com/apache/airflow/pull/27633#discussion_r1036413625


##########
airflow/providers/atlassian/jira/sensors/jira.py:
##########
@@ -96,38 +93,38 @@ def __init__(
         if field_checker_func is None:
             field_checker_func = self.issue_field_checker
 
-        super().__init__(jira_conn_id=jira_conn_id, 
result_processor=field_checker_func, **kwargs)
+        super().__init__(
+            jira_conn_id=jira_conn_id, method_name="issue", 
result_processor=field_checker_func, **kwargs
+        )
 
     def poke(self, context: Context) -> Any:
         self.log.info("Jira Sensor checking for change in ticket: %s", 
self.ticket_id)
 
         self.method_name = "issue"
-        self.method_params = {"id": self.ticket_id, "fields": self.field}
+        self.method_params = {"key": self.ticket_id, "fields": self.field}
         return JiraSensor.poke(self, context=context)
 
-    def issue_field_checker(self, issue: Issue) -> bool | None:
+    def issue_field_checker(self, jira_result: dict) -> bool | None:
         """Check issue using different conditions to prepare to evaluate 
sensor."""
         result = None
         try:
-            if issue is not None and self.field is not None and 
self.expected_value is not None:
+            if jira_result is not None and self.field is not None and 
self.expected_value is not None:
 
-                field_val = getattr(issue.fields, self.field)
+                field_val = jira_result.get("fields", {}).get(self.field, None)
                 if field_val is not None:
                     if isinstance(field_val, list):
                         result = self.expected_value in field_val
                     elif isinstance(field_val, str):
                         result = self.expected_value.lower() == 
field_val.lower()
-                    elif isinstance(field_val, Resource) and 
getattr(field_val, "name"):
-                        result = self.expected_value.lower() == 
field_val.name.lower()
+                    elif isinstance(field_val, dict) and field_val.get("name", 
None):
+                        result = self.expected_value.lower() == 
field_val.get("name", "").lower()
                     else:
                         self.log.warning(
                             "Not implemented checker for issue field %s which "
                             "is neither string nor list nor Jira Resource",
                             self.field,
                         )
 
-        except JIRAError as jira_error:
-            self.log.error("Jira error while checking with expected value: 
%s", jira_error)
         except Exception:
             self.log.exception("Error while checking with expected value %s:", 
self.expected_value)

Review Comment:
   Made the changes here by only keeping the HTTPError to log the response from 
it. Other will just raise with whatever exception that comes.
   Ref: 
https://github.com/apache/airflow/pull/27633/files#diff-8edbc4ba86e754ffa8636bf167fa0a0e1eb9bd47f134a1d78103b3b7dad55b10R130



-- 
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]

Reply via email to