This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 23b5b31d48 Fix `airflow providers get` command output (#30978)
23b5b31d48 is described below
commit 23b5b31d48a1c8fc784022c641b33b4ba837d549
Author: Pankaj Singh <[email protected]>
AuthorDate: Mon May 1 21:07:34 2023 +0530
Fix `airflow providers get` command output (#30978)
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`
---
airflow/cli/commands/provider_command.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/airflow/cli/commands/provider_command.py
b/airflow/cli/commands/provider_command.py
index abb9d7f0ef..75c354d686 100644
--- a/airflow/cli/commands/provider_command.py
+++ b/airflow/cli/commands/provider_command.py
@@ -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}")