uranusjr commented on code in PR #27034:
URL: https://github.com/apache/airflow/pull/27034#discussion_r1023416206
##########
airflow/cli/commands/connection_command.py:
##########
@@ -75,13 +79,20 @@ def connections_get(args):
@suppress_logs_and_warning
def connections_list(args):
"""Lists all connections at the command line"""
+ airflow_console = AirflowConsole()
+ if CUSTOM_BACKEND:
+ warning = warn_list_secrets_alternative_backend(cli_or_ui="cli",
connection_or_variable="connection")
+ airflow_console.print(
+ f'WARNING: {warning}',
+ style="magenta",
+ )
Review Comment:
```suggestion
airflow_console.print(f"WARNING: {warning}", style="magenta")
```
##########
airflow/cli/commands/variable_command.py:
##########
@@ -23,18 +23,29 @@
from json import JSONDecodeError
from airflow.cli.simple_table import AirflowConsole
+from airflow.configuration import get_custom_secret_backend
from airflow.models import Variable
from airflow.utils import cli as cli_utils
from airflow.utils.cli import suppress_logs_and_warning
from airflow.utils.session import create_session
+from airflow.utils.warnings import warn_list_secrets_alternative_backend
+
+CUSTOM_BACKEND: bool = True if get_custom_secret_backend() else False
Review Comment:
This shouldn’t need to be repeated. Should we instead extract this to
somewhere shared between both modules?
##########
airflow/cli/commands/variable_command.py:
##########
@@ -23,18 +23,29 @@
from json import JSONDecodeError
from airflow.cli.simple_table import AirflowConsole
+from airflow.configuration import get_custom_secret_backend
from airflow.models import Variable
from airflow.utils import cli as cli_utils
from airflow.utils.cli import suppress_logs_and_warning
from airflow.utils.session import create_session
+from airflow.utils.warnings import warn_list_secrets_alternative_backend
+
+CUSTOM_BACKEND: bool = True if get_custom_secret_backend() else False
@suppress_logs_and_warning
def variables_list(args):
"""Displays all of the variables"""
+ airflow_console = AirflowConsole()
+ if CUSTOM_BACKEND:
+ warning = warn_list_secrets_alternative_backend(cli_or_ui="cli",
connection_or_variable="variable")
+ airflow_console.print(
+ f'WARNING: {warning}',
+ style="magenta",
+ )
Review Comment:
```suggestion
airflow_console.print(f"WARNING: {warning}", style="magenta")
```
--
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]