potiuk commented on code in PR #72958:
URL: https://github.com/apache/airflow/pull/72958#discussion_r4308064162


##########
airflow-core/src/airflow/cli/commands/variable_command.py:
##########
@@ -169,12 +169,12 @@ def variables_import(args, *, session: Session = 
NEW_SESSION):
         else:
             suc_count += 1
     print(f"{suc_count} of {len(var_json)} variables successfully updated.")
-    if fail_count:
-        print(f"{fail_count} variable(s) failed to be updated.")
     if skipped:
         print(
-            f"The variables with these keys: {list(sorted(skipped))} were 
skipped because they already exists"
+            f"The variables with these keys: {list(sorted(skipped))} were 
skipped because they already exist"
         )
+    if fail_count:
+        raise SystemExit(f"{fail_count} variable(s) failed to be updated.")

Review Comment:
   Listing the failed keys here (collected next to `fail_count += 1` above) 
would tell the operator what to fix, like `pools import` does:
   
   ```python
       if failed_keys:
           raise SystemExit(f"Failed to import variable(s): {', 
'.join(sorted(failed_keys))}")
   ```



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