shahar1 commented on code in PR #70437:
URL: https://github.com/apache/airflow/pull/70437#discussion_r3654580570
##########
providers/standard/src/airflow/providers/standard/operators/bash.py:
##########
@@ -215,7 +213,7 @@ def execute(self, context: Context):
raise AirflowException(f"The cwd {self.cwd} must be a
directory")
env = self.get_env(context)
- if self._is_inline_cmd:
+ if self._is_inline_command(self.bash_command):
Review Comment:
For a literal `bash_command="script.sh"`, `render_template_fields`
replaces the value with the rendered **file content** before `execute()` runs
(template-ext handling in the SDK templater). Classifying the rendered value
therefore sees script content - which rarely ends in `.sh` - so the
script-file
case now runs via `bash -c "<entire script>"` instead of
`_run_rendered_script_file`, defeating that path's purpose ("prevents
'Argument
list too long' error"; Linux caps one argv entry at ~128 KiB).
The raw-value classification was correct - only its location in `__init__`
was
the problem. Suggest classifying pre-render instead:
```python
def render_template_fields(self, context, jinja_env=None):
if isinstance(self.bash_command, str):
self._is_inline_cmd =
self._is_inline_command(bash_command=self.bash_command)
super().render_template_fields(context, jinja_env)
```
---
Drafted by Claude (using Apache Magpie), reviewed by me:
--
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]