evgenii-prusov commented on code in PR #53726:
URL: https://github.com/apache/airflow/pull/53726#discussion_r2251816721
##########
airflow-core/src/airflow/cli/commands/variable_command.py:
##########
@@ -81,20 +81,25 @@ def variables_import(args, session):
"""Import variables from a given file."""
if not os.path.exists(args.file):
raise SystemExit("Missing variables file.")
- with open(args.file) as varfile:
- try:
- var_json = json.load(varfile)
- except JSONDecodeError:
- raise SystemExit("Invalid variables file.")
+
+ try:
+ # Use load_variables which supports JSON, YAML, and ENV formats
+ var_dict = load_variables(args.file)
+ except Exception as e:
Review Comment:
> Yep, but fail early is still better
I'm not sure I've got you point. Could you please clarify what exactly do
you mean?
Current error handling strategy (as I understand it) is to catch parsing
errors from 3 low-level parser functions `_parse_<env|json|yaml>_file`,
repackage and return them as lists of `FileSyntaxError` to the caller
`_parse_secret_file` and let the caller raise the `AirflowFileParseException`
with all collected errors, which let the users see all the issues in their
configuration files at once rather than making them fix one by one.
--
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]