You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2017/03/16 23:43:42 UTC

[jira] [Commented] (AIRFLOW-706) Configuration shell commands are not split properly

    [ https://issues.apache.org/jira/browse/AIRFLOW-706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15929176#comment-15929176 ] 

ASF subversion and git services commented on AIRFLOW-706:
---------------------------------------------------------

Commit 0bb6f2f458ddf305d77fc63d5e817c9b6eb22270 in incubator-airflow's branch refs/heads/master from [~thesquelched]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-airflow.git;h=0bb6f2f ]

[AIRFLOW-705][AIRFLOW-706] Fix run_command bugs

`run_command` currently uses `str.split` for shell
commands, but this
breaks commands like `echo "foo bar"`.  Instead,
use `shlex.split`,
which understands how to handle quotes.

In python3, subprocess functions return
stdout/stderr as `bytes`, not
`str`.  To fix py2/py3 compatibility,
`run_command` now decodes the
output so that it always returns a `str`.

Dear Airflow Maintainers,

Please accept this PR that addresses the following
issues:
-
https://issues.apache.org/jira/browse/AIRFLOW-705
-
https://issues.apache.org/jira/browse/AIRFLOW-706

Testing Done:
- Changed `sql_alchemy_conn` to
`sql_alchemy_conn_cmd` in test configuration to
exercise `run_command` in tests

Closes #2053 from thesquelched/AIRFLOW-706


> Configuration shell commands are not split properly
> ---------------------------------------------------
>
>                 Key: AIRFLOW-706
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-706
>             Project: Apache Airflow
>          Issue Type: Bug
>    Affects Versions: Airflow 1.7.1.3
>            Reporter: Scott Kruger
>             Fix For: 1.9.0
>
>
> The command string in {{airflow.configuration.run_command}} is split with {{str.split}} instead of {{shlex.split}}; this can cause problems when a valid command includes an argument with spaces, e.g.
> {noformat}
> echo "foo bar"
> {noformat}
>  is split into 
> {noformat}
> ['echo', '"foo', 'bar"']
> {noformat}
> See: https://github.com/apache/incubator-airflow/blob/master/airflow/configuration.py#L79



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)