Hey Rosario, no the doc is wrong. There should be no spaces. There’s a reason why variables have underscores in names
With spaces you’ll get:
/etc/ralph/conf.d/ldap.conf: line 1: AUTH_LDAP_SERVER_URI: command not found
There’s sanity check in /opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/accounts/management/commands/ldap_sync.py
def check_settings_existence(self):
"""Check if all needed settings are defined in settings.py"""
options = [
'AUTH_LDAP_SERVER_URI',
'AUTH_LDAP_USER_SEARCH_BASE',
'AUTH_LDAP_USER_USERNAME_ATTR',
'AUTH_LDAP_PROTOCOL_VERSION',
'AUTH_LDAP_BIND_DN',
'AUTH_LDAP_BIND_PASSWORD',
]
for option in options:
if not hasattr(settings, option):
logger.error((
'LDAP::check_settings_existence\tSetting {} is not provided'
).format(option))
sys.exit(1)
If I comment it out I get:
Traceback (most recent call last):
File "/opt/ralph/ralph-core/bin/ralph", line 10, in <module>
sys.exit(prod())
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/__main__.py", line 28, in prod
main('ralph.settings.prod')
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/__main__.py", line 14, in main
execute_from_command_line(sys.argv)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/core/management/__init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/core/management/base.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/core/management/base.py", line 445, in execute
output = self.handle(*args, **options)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/accounts/management/commands/ldap_sync.py", line 271, in handle
synced = self.populate_users()
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/accounts/management/commands/ldap_sync.py", line 277, in populate_users
for user_dn, ldap_dict in self._get_users():
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/accounts/management/commands/ldap_sync.py", line 187, in _run_ldap_query
with LDAPConnectionManager() as conn:
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/accounts/management/commands/ldap_sync.py", line 41, in __init__
self.conn = ldap.initialize(settings.AUTH_LDAP_SERVER_URI)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/conf/__init__.py", line 49, in __getattr__
return getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'AUTH_LDAP_SERVER_URI'
@rdarioc did you manage to run LDAP?