airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <>
Subject [jira] [Commented] (AIRFLOW-840) Python3 encoding issue in Kerberos
Date Tue, 28 Mar 2017 23:50:41 GMT


ASF subversion and git services commented on AIRFLOW-840:

Commit 6393366a781c0c6c5806a830d419929296d71a08 in incubator-airflow's branch refs/heads/master
from [~abij]
[;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:
>             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/", line 600, in kerberos
>   File "/usr/local/lib/python3.4/dist-packages/airflow/security/", line 110,
in run
>     renew_from_kt()
>   File "/usr/local/lib/python3.4/dist-packages/airflow/security/", 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

View raw message