YangMuye opened a new issue #14543: URL: https://github.com/apache/airflow/issues/14543
**Apache Airflow version**: 2.0.1 **Kubernetes version (if you are using kubernetes)** (use `kubectl version`): n/a **Environment**: - **Cloud provider or hardware configuration**: - **OS** (e.g. from /etc/os-release): redhat 7.9 - **Kernel** (e.g. `uname -a`): 3.10.0-1160.11.1.el7.x86_64 - **Install tools**: pip - **Others**: **What happened**: Given the following code ``` SSHOperator(task_id='dummy', command='''\ for i in 1..100 do echo $i echo $i $i echo $i $i $i done ''') ``` The `command` field is rendered as: ``` '\n\nfor i in 1..100\ndo\necho $i\necho $i $i\necho $i $i $i\ndone\n' ``` **What you expected to happen**: I expect to see ``` for i in 1..100 do echo $i echo $i $i echo $i $i $i done ``` **How to reproduce it**: **Anything else we need to know**: The is because the following line renders templated fields using the `pformat` function. https://github.com/apache/airflow/blob/35c9a902929b79cf7cf53ac5b90c3565dddb97dc/airflow/www/views.py#L926-L928 I suggest we should render strings as is. ```diff if renderer in renderers: html_dict[template_field] = renderers[renderer](content) else: html_dict[template_field] = Markup("<pre><code>{}</pre></code>").format( pformat(content) + content if isinstance(content, str) else pformat(content) ) # noqa ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
