Andrew Stahlman created AIRFLOW-3922:
----------------------------------------
Summary: Consolidate hostname-reporting behind customizable
interface
Key: AIRFLOW-3922
URL: https://issues.apache.org/jira/browse/AIRFLOW-3922
Project: Apache Airflow
Issue Type: Improvement
Reporter: Andrew Stahlman
There are several ways of getting a network address in use throughout the code
base, including:
*
[socket.gethostname()|https://github.com/apache/incubator-airflow/blob/daec2ff7db64e979c2d8f15787c0ccfdb433647e/airflow/utils/cli.py#L105]
*
[socket.getfqdn()|https://github.com/apache/incubator-airflow/blob/daec2ff7db64e979c2d8f15787c0ccfdb433647e/airflow/www/views.py#L461]
*
[socket.gethostbyaddr()|https://github.com/apache/incubator-airflow/blob/daec2ff7db64e979c2d8f15787c0ccfdb433647e/airflow/contrib/auth/backends/kerberos_auth.py#L57]
{{gethostname()}} and {{getfqdn()}} will not necessarily return the same value.
It would be nice to consolidate these usages into a single interface like
{{gethostname}} or, perhaps more generic, {{gethostaddress}}, which returns a
consistent value.
Ideally, the implementation would be swappable, too. My company has a slightly
unusual usecase where the hostname in {{/etc/hostname}} does not actually
resolve via DNS. We have a local patch where we replace usages of gethostname()
and getfqdn() with a call to get the private IP address. If this proposed
interface existed, we could swap in our own implemenation by updating a key in
{{~/airflow.cfg}} to specify a custom hostname provider, i.e.,
{noformat}
[core]
hostname_provider=our.custom.module.gethostname
{noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)