Skip to content

Commit af4c3d1

Browse files
authored
fix: Inject ldap implicitly to the settings loader
``` File "/etc/tower/conf.d/ldap.py", line 2, in <module> ldap.OPT_X_TLS_REQUIRE_CERT: True, ^^^^ NameError: name 'ldap' is not defined ```
1 parent a46ebe5 commit af4c3d1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ansible_base/lib/dynamic_config/dynaconf_helpers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import inspect
4+
import ldap
45
import os
56
import sys
67
from pathlib import Path
@@ -269,6 +270,8 @@ def load_python_file_with_injected_context(*paths: str, settings: Dynaconf, run_
269270
files_to_load = glob(pattern)
270271
for file_path in files_to_load:
271272
scope = settings.as_dict()
273+
# Inject ldap module because some custom config expect it on the global scope
274+
scope["ldap"] = ldap
272275
file_path = os.path.abspath(file_path)
273276
with open(file_path, "rb") as to_compile:
274277
code = compile(to_compile.read(), file_path, "exec")

0 commit comments

Comments
 (0)