Skip to content

airflow config list command fails with google_auth configuration  #14687

@dkinzer

Description

@dkinzer

Apache Airflow version:

1.10.14

Kubernetes version (if you are using kubernetes) (use kubectl version):

Environment:

  • Cloud provider or hardware configuration:

  • OS (e.g. from /etc/os-release):
    Official docker image (apache/airflow:1.10.14)

  • Kernel (e.g. uname -a):

  • Install tools:

  • Others:

What happened:
After following all the requirements as specified in the docs for setting up security via google_auth: https://airflow.apache.org/docs/apache-airflow/1.10.14/security.html#google-authentication, the following command throws an error

airflow@2fd70685e00d:/opt/airflow$ airflow config list
Traceback (most recent call last):
  File "/home/airflow/.local/bin/airflow", line 37, in <module>
    args.func(args)
  File "/home/airflow/.local/lib/python3.6/site-packages/airflow/utils/cli.py", line 233, in wrapper
    func(args)
  File "/home/airflow/.local/lib/python3.6/site-packages/airflow/bin/cli.py", line 2083, in config
    conf.write(output)
  File "/home/airflow/.local/lib/python3.6/site-packages/airflow/configuration.py", line 503, in write
    self._write_section(fp, section, self.getsection(section).items(), d)  # type: ignore
  File "/home/airflow/.local/lib/python3.6/site-packages/airflow/configuration.py", line 465, in getsection
    _section = copy.deepcopy(self.airflow_defaults._sections[section])
KeyError: 'google'
airflow@2fd70685e00d:/opt/airflow$
airflow@2fd70685e00d:/opt/airflow$
airflow@2fd70685e00d:/opt/airflow$
airflow@2fd70685e00d:/opt/airflow$
airflow@2fd70685e00d:/opt/airflow$
airflow@2fd70685e00d:/opt/airflow$ airflow config list
Traceback (most recent call last):
  File "/home/airflow/.local/bin/airflow", line 37, in <module>
    args.func(args)
  File "/home/airflow/.local/lib/python3.6/site-packages/airflow/utils/cli.py", line 233, in wrapper
    func(args)
  File "/home/airflow/.local/lib/python3.6/site-packages/airflow/bin/cli.py", line 2083, in config
    conf.write(output)
  File "/home/airflow/.local/lib/python3.6/site-packages/airflow/configuration.py", line 503, in write
    self._write_section(fp, section, self.getsection(section).items(), d)  # type: ignore
  File "/home/airflow/.local/lib/python3.6/site-packages/airflow/configuration.py", line 465, in getsection
    _section = copy.deepcopy(self.airflow_defaults._sections[section])
KeyError: 'google'

What you expected to happen:
I expect the configurations to be listed without throwing an error.

How to reproduce it:
You can reproduce this on a clean install of airflow or using the official airflow docker image.

Run:
pip install 'apache-airflow[google_auth]'

Add the following to airflow.cfg file:

[google]
client_id = google_client_id
client_secret = google_client_secret
oauth_callback_route = /oauth2callback
domain = example1.com,example2.com
prompt = <One of : consent, select_account, none or ''>

Then run the following command from the cli:

airflow config list

Anything else we need to know:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugThis is a clearly a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions