dstandish commented on code in PR #49270:
URL: https://github.com/apache/airflow/pull/49270#discussion_r2044514048


##########
providers/git/src/airflow/providers/git/bundles/git.py:
##########
@@ -79,16 +80,20 @@ def __init__(
         )
 
         self._log.debug("bundle configured")
-        try:
-            self.hook = GitHook(git_conn_id=self.git_conn_id, 
repo_url=self.repo_url)
-            self.repo_url = self.hook.repo_url
-            self._log.debug("repo_url updated from hook", 
repo_url=self.repo_url)
-        except AirflowException as e:
-            self._log.warning("Could not create GitHook", 
conn_id=self.git_conn_id, exc=e)
+        self.hook: GitHook | None = None
+        if self.git_conn_id:
+            try:
+                self.hook = GitHook(git_conn_id=self.git_conn_id, 
repo_url=self.repo_url)
+            except AirflowException as e:
+                self._log.warning("Could not create GitHook", 
conn_id=self.git_conn_id, exc=e)
+            else:
+                self.repo_url = self.hook.repo_url
+                self._log.debug("repo_url updated from hook", 
repo_url=self.repo_url)

Review Comment:
   the "why would you supply both" thing...
   
   the issue i envision is you have one git conn that you want to use for 
multiple things.  
   
   multiple bundles could use the same git conn, but not the other way around.
   
   so therefore it seems reasonable to defer to the bundle config.
   
   it's like when you have an operator, sometimes an option may be specified 
either at hook or operator, but usually if in both, you defer to operator, for 
the same reason.



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