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


##########
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:
   static check should be fixed now and rebased to latest main branch. Sorry, I 
didn't have docker setup for running pre-commit while starting PR.
   
   Regarding moving the `MASK_SECRETS_IN_LOGS` check to `filter` method in 
`SecretsMasker` I saw some test errors on the change. This change also set and 
reset the variable in finally block on per request basis like task command in 
cli that does it per invocation.



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