amoghrajesh commented on code in PR #43123:
URL: https://github.com/apache/airflow/pull/43123#discussion_r1806405601


##########
airflow/utils/cli.py:
##########
@@ -140,10 +141,17 @@ def _build_metrics(func_name, namespace):
     :return: dict with metrics
     """
     sub_commands_to_check = {"users", "connections"}

Review Comment:
   Understandable. The variable naming isn't too clear.
   Instead if we refactor `sub_commands_to_check` as 
`sub_commands_to_check_for_sensitive_fields` and this one 
(`sub_commands_to_check_based_upon_key`) as 
`sub_commands_to_check_for_sensitive_indexes` would make more semantic sense



##########
tests/utils/test_cli_util.py:
##########
@@ -185,6 +185,47 @@ def test_get_dag_by_pickle(self, session, dag_maker):
         with pytest.raises(AirflowException, match="pickle_id could not be 
found .* -42"):
             get_dag_by_pickle(pickle_id=-42, session=session)
 
+    @pytest.mark.parametrize(
+        ["given_command", "expected_masked_command"],
+        [
+            (
+                "airflow variables set --description 'needed for dag 4' 
client_secret_234 7fh4375f5gy353wdf",
+                "airflow variables set --description 'needed for dag 4' 
client_secret_234 ********",
+            ),
+            (
+                "airflow variables set cust_secret_234 7fh4375f5gy353wdf",
+                "airflow variables set cust_secret_234 ********",

Review Comment:
   My bad.



##########
airflow/utils/cli.py:
##########
@@ -140,10 +141,17 @@ def _build_metrics(func_name, namespace):
     :return: dict with metrics
     """
     sub_commands_to_check = {"users", "connections"}
+    sub_commands_to_check_based_upon_key = {"variables"}
     sensitive_fields = {"-p", "--password", "--conn-password"}

Review Comment:
   Answered above, this can be ignored and answered in the other comment as 
that will comprise this now



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