try: global login login = import_module(auth_backend) except ImportError as err: logging.critical( "Cannot import authentication module %s. " "Please correct your authentication backend or disable authentication: %s", auth_backend, err ) if conf.getboolean('webserver', 'AUTHENTICATE'): raise AirflowException("Failed to import authentication backend") class AirflowViewPlugin(BaseView): pass class AirflowMacroPlugin(object): def __init__(self, namespace): self.namespace = namespace from airflow import operators from airflow import hooks from airflow import executors from airflow import macros from airflow import contrib operators.integrate_plugins() hooks.integrate_plugins() macros.integrate_plugins()
sys.path.append(DAGS_FOLDER) from airflow import default_login as login if conf.getboolean('webserver', 'AUTHENTICATE'): try: # Environment specific login import airflow_login as login except ImportError: logging.error("authenticate is set to True in airflow.cfg, " "but airflow_login failed to import") class AirflowViewPlugin(BaseView): pass class AirflowMacroPlugin(object): def __init__(self, namespace): self.namespace = namespace from airflow import operators from airflow import hooks from airflow import executors from airflow import macros from airflow import contrib operators.integrate_plugins() hooks.integrate_plugins() macros.integrate_plugins()