SameerMesiah97 commented on code in PR #69768:
URL: https://github.com/apache/airflow/pull/69768#discussion_r3642131156


##########
airflow-core/src/airflow/cli/commands/team_command.py:
##########
@@ -172,10 +199,27 @@ def team_sync(args, *, session=NEW_SESSION):
     teams_added = 0
 
     try:
-        for team_name in dag_bundle_teams - 
Team.get_all_team_names(session=session):
-            team = Team(name=team_name)
-            session.add(team)
-            teams_added += 1
+        existing_teams = Team.get_all_team_names(session=session)
+        for team_name in dag_bundle_teams:
+            if team_name not in existing_teams:
+                session.add(Team(name=team_name))
+                teams_added += 1
+
+            session.flush()
+
+            if conf.getboolean("core", "multi_team"):

Review Comment:
   The function now returns early if multi-team is not enabled. 



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