Skip to content

Commit

Permalink
Fix airflow providers get command output (#30978)
Browse files Browse the repository at this point in the history
If I use the `airflow provider get <provider-name> -o json/yaml` CLI command
it does not respect `-o` option.
It works perfectly fine when I pass the `--full` option also in the above command.
The issue is currently if the `--full` option is not provided we
use standard statement print to print results and not the custom AirflowConsole.
In this PR I'm replacing print with `AirflowConsole().print_as`
  • Loading branch information
pankajastro authored May 1, 2023
1 parent b4220ef commit 23b5b31
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions airflow/cli/commands/provider_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ def provider_get(args):
output=args.output,
)
else:
print(f"Provider: {args.provider_name}")
print(f"Version: {provider_version}")
AirflowConsole().print_as(
data=[{"Provider": args.provider_name, "Version": provider_version}], output=args.output
)
else:
raise SystemExit(f"No such provider installed: {args.provider_name}")

Expand Down

0 comments on commit 23b5b31

Please sign in to comment.