Uploaded image for project: 'Apache Airflow'
  1. Apache Airflow
  2. AIRFLOW-840

Python3 encoding issue in Kerberos

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.0
    • Fix Version/s: 1.9.0
    • Component/s: security
    • Labels:
    • Environment:
      $ python --version
      Python 3.4.3

      Description

      While attempting to configure Kerberos ticket renewal in a Python3 environment, I encountered this encoding issue trying to run airflow kerberos:

      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
      

      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')

        Attachments

          Activity

            People

            • Assignee:
              abij Alexander Bij
              Reporter:
              erikcederstrand Erik Cederstrand
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: