kaxil commented on code in PR #44820:
URL: https://github.com/apache/airflow/pull/44820#discussion_r1878577289


##########
newsfragments/44819.significant.rst:
##########
@@ -0,0 +1,43 @@
+Removed ``conf`` from the Task template context
+
+The ``conf`` variable, which provided access to the full Airflow configuration 
(``airflow.cfg``), has been
+removed from the Task (Jinja2) template context for security and simplicity. 
If you
+need specific configuration values in your tasks, retrieve them explicitly in 
your DAG or task code
+using the ``airflow.configuration.conf`` module.
+
+For users retrieving the webserver URL (e.g., to include log links in task or 
callbacks), one of the
+most common use-case, use the ``ti.log_url`` property available in the 
``TaskInstance`` context instead.
+
+Example:
+
+.. code-block:: python
+
+    from airflow.providers.standard.operators.python import PythonOperator
+    from airflow.providers.smtp.notifications.smtp import SmtpNotifier
+
+
+    def my_task_callable(ti):
+        log_url = ti.log_url  # Retrieve the log URL
+
+
+    with DAG("my_dag", schedule_interval="@daily") as dag:
+        task = PythonOperator(
+            task_id="my_task",
+            python_callable=my_task_callable,
+            on_failure_callback=SmtpNotifier(
+                from_email="[email protected]",
+                to="[email protected]",
+                subject="Task {{ ti.task_id }} failed",
+                html_content="Task <b>{{ ti.task_id }}</b> failed. Log URL: {{ 
ti.log_url }}",
+            ),
+        )

Review Comment:
   addressed in 
https://github.com/apache/airflow/pull/44820/commits/841f1a1140e54ae47fcb4cd8646521481f92ecc5



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