No prompt at first install

This commit is contained in:
Kloadut 2012-10-29 16:25:40 +01:00
parent 88ccca8c89
commit 15207ecef5
3 changed files with 8 additions and 6 deletions

View file

@ -480,8 +480,6 @@ tools:
### tools_postinstall()
postinstall:
action_help: YunoHost post-install
connections:
- ldap
arguments:
-d:
full: --domain

View file

@ -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:

View file

@ -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: