File tree Expand file tree Collapse file tree
rust/operator-binary/src/controller/build/properties Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,10 +86,28 @@ pub fn build(
8686
8787 let temp_file_footer: Option < String > = config. remove ( CONFIG_OVERRIDE_FILE_FOOTER_KEY ) ;
8888
89+ // Workaround for apache-airflow-providers-fab 3.6.x: `_search_ldap` calls
90+ // `ldap.filter.escape_filter_chars` without ever importing `ldap.filter`, so every LDAP
91+ // login fails with `AttributeError: module 'ldap' has no attribute 'filter'` (the
92+ // `filter` submodule is not auto-loaded by `import ldap`). Importing it here registers
93+ // the submodule on the `ldap` package for the whole webserver process, which makes the
94+ // FAB code resolve it. Fixed upstream in FAB 3.7.0 (apache/airflow#68226); this import
95+ // is a harmless no-op there and on any python-ldap version.
96+ let mut imports = PYTHON_IMPORTS . to_vec ( ) ;
97+ let has_ldap = validated_cluster
98+ . cluster_config
99+ . authentication_config
100+ . authentication_classes_resolved
101+ . iter ( )
102+ . any ( |auth_class| matches ! ( auth_class, AirflowAuthenticationClassResolved :: Ldap { .. } ) ) ;
103+ if has_ldap {
104+ imports. push ( "import ldap.filter" ) ;
105+ }
106+
89107 flask_config_writer:: write :: < AirflowConfigOptions , _ , _ > (
90108 & mut config_file,
91109 config. iter ( ) ,
92- PYTHON_IMPORTS ,
110+ & imports ,
93111 )
94112 . context ( WriteConfigFileSnafu ) ?;
95113
You can’t perform that action at this time.
0 commit comments