diff --git a/action_map.yml b/action_map.yml index c90d4d11..add665e9 100644 --- a/action_map.yml +++ b/action_map.yml @@ -480,8 +480,6 @@ tools: ### tools_postinstall() postinstall: action_help: YunoHost post-install - connections: - - ldap arguments: -d: full: --domain diff --git a/yunohost.py b/yunohost.py index 1c628805..4b0d0a63 100644 --- a/yunohost.py +++ b/yunohost.py @@ -245,7 +245,7 @@ class YunoHostError(Exception): class YunoHostLDAP: """ Specific LDAP functions for YunoHost """ - def __init__(self): + def __init__(self, password=False): """ Connect to LDAP base @@ -254,7 +254,10 @@ class YunoHostLDAP: """ self.conn = ldap.initialize('ldap://localhost:389') self.base = 'dc=yunohost,dc=org' - self.pwd = getpass.getpass(colorize(_('LDAP Admin Password: '), 'yellow')) + if password: + self.pwd = password + else: + self.pwd = getpass.getpass(colorize(_('Admin Password: '), 'yellow')) try: self.conn.simple_bind_s('cn=admin,' + self.base, self.pwd) except ldap.INVALID_CREDENTIALS: diff --git a/yunohost_tools.py b/yunohost_tools.py index 6692e2f4..f6866f35 100644 --- a/yunohost_tools.py +++ b/yunohost_tools.py @@ -5,7 +5,7 @@ import sys import yaml import re import getpass -from yunohost import YunoHostError, validate, colorize, get_required_args, win_msg +from yunohost import YunoHostError, YunoHostLDAP, validate, colorize, get_required_args, win_msg def tools_ldapinit(args, connections): @@ -154,7 +154,7 @@ def tools_maindomain(args): raise YunoHostError(17, _("There were a problem during domain changing")) -def tools_postinstall(args, connections): +def tools_postinstall(args): """ Post-install configuration @@ -166,6 +166,7 @@ def tools_postinstall(args, connections): dict """ + connections = { 'ldap' : YunoHostLDAP(password='yunohost') } try: with open('/usr/share/yunohost/yunohost-config/others/installed') as f: pass except IOError: