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/28 23:50:41 UTC

[jira] [Commented] (AIRFLOW-840) Python3 encoding issue in Kerberos

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

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

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

[AIRFLOW-840] Make ticket renewer python3 compatible

The return from the subprocess is in bytes when
the universal
newlines is set to False (default). This will fail
in Py3 and
works fine in Py2. And with a working unit test.

Closes #2158 from abij/AIRFLOW-840


> Python3 encoding issue in Kerberos
> ----------------------------------
>
>                 Key: AIRFLOW-840
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-840
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: security
>    Affects Versions: Airflow 1.8
>         Environment: $ python --version
> Python 3.4.3
>            Reporter: Erik Cederstrand
>            Assignee: Alexander Bij
>              Labels: security
>
> While attempting to configure Kerberos ticket renewal in a Python3 environment, I encountered this encoding issue trying to run {{airflow kerberos}}:
> {code:none}
> Traceback (most recent call last):
>   File "/usr/local/bin/airflow", line 15, in <module>
>     args.func(args)
>   File "/usr/local/lib/python3.4/dist-packages/airflow/bin/cli.py", line 600, in kerberos
>     airflow.security.kerberos.run()
>   File "/usr/local/lib/python3.4/dist-packages/airflow/security/kerberos.py", line 110, in run
>     renew_from_kt()
>   File "/usr/local/lib/python3.4/dist-packages/airflow/security/kerberos.py", line 55, in renew_from_kt
>     "\n".join(subp.stderr.readlines())))
> TypeError: sequence item 0: expected str instance, bytes found
> {code}
> The issue here (ignoring for a moment why {{kinit}} is failing on my machine) is that Popen in Python3 returns {{bytes}} for stdin/stdout, but both are handled as if they are {{str}}.
> I'm unsure what the Py2/3 compat policy is at Airflow, but a simple {{from six import PY2}} and an if/else seems like the least intrusive fix. The non-PY2 path would then add something like {{subp.stdin.readlines().decode(errors='ignore')}}



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