You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/04/06 11:19:38 UTC

[GitHub] [airflow] tirkarthi commented on a diff in pull request #22754: Fix secrets rendered in UI when task is not executed.

tirkarthi commented on code in PR #22754:
URL: https://github.com/apache/airflow/pull/22754#discussion_r843821720


##########
airflow/models/taskinstance.py:
##########
@@ -2069,15 +2069,27 @@ def get_rendered_template_fields(self, session: Session = NEW_SESSION) -> None:
                 setattr(self.task, field_name, rendered_value)
             self.task = task
             return
+
         try:
-            self.render_templates()
+            # Task was never executed. Initialize RenderedTaskInstanceFields
+            # to render template and mask secrets. Set MASK_SECRETS_IN_LOGS
+            # to True to enable masking similar to task run.
+            original_value = settings.MASK_SECRETS_IN_LOGS
+            settings.MASK_SECRETS_IN_LOGS = True

Review Comment:
   I agree this is setting a flag that has the side_effect of masking it in template rendering which seems slightly unrelated. This setting is done in task run command and I tries to emulate this here. We can change signature to add a parameter like force but open to better approach. The suggestion to make this parameter to filter also seems good.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org