From 7648b641e2370839141b753981e1d2036edfbf4f Mon Sep 17 00:00:00 2001 From: root Date: Thu, 25 Oct 2012 19:52:59 +0200 Subject: [PATCH] fixes --- yunohost.py | 2 +- yunohost_tools.py | 29 +++++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/yunohost.py b/yunohost.py index f4caebf9..7c28e66a 100644 --- a/yunohost.py +++ b/yunohost.py @@ -125,7 +125,7 @@ def get_required_args(args, required_args, password=False): else: raise Exception #FIX # Password - if not 'password' in args and password and 'password' in required_args: + if 'password' not in args and password and 'password' in required_args: if os.isatty(1): args['password'] = getpass.getpass(colorize(required_args['password'] + ': ', 'cyan')) pwd2 = getpass.getpass(colorize('Retype ' + required_args['password'][0].lower() + required_args['password'][1:] + ': ', 'cyan')) diff --git a/yunohost_tools.py b/yunohost_tools.py index ef2fe360..27ec0727 100644 --- a/yunohost_tools.py +++ b/yunohost_tools.py @@ -163,24 +163,25 @@ def tools_postinstall(args, connections): dict """ - with get_required_args(args, {'domain' : _('Main domain name'), 'password' : _('New admin password') }, True) as args: + args = get_required_args(args, {'domain' : _('Main domain name'), 'password' : _('New admin password') }, True) - try: - with open('/usr/share/yunohost/yunohost-config/others/installed') as f: pass - except IOError: - print('Installing YunoHost') - else: - raise YunoHostError(17, _("YunoHost is already installed")) + try: + with open('/usr/share/yunohost/yunohost-config/others/installed') as f: pass + except IOError: + print('Installing YunoHost') + else: + raise YunoHostError(17, _("YunoHost is already installed")) - # Initialize YunoHost LDAP base - tools_ldapinit(args, connections) + # Initialize YunoHost LDAP base + tools_ldapinit(args, connections) - # Change LDAP admin password - tools_adminpw({ 'old' : 'yunohost', 'new' : args['password']}) + print(args) + # Change LDAP admin password + tools_adminpw({ 'old' : 'yunohost', 'new' : args['password']}) - # New domain config - tools_maindomain({ 'old' : 'yunohost.org', 'new' : args['domain']}) + # New domain config + tools_maindomain({ 'old' : 'yunohost.org', 'new' : args['domain']}) - os.system('touch /usr/share/yunohost/yunohost-config/others/installed') + os.system('touch /usr/share/yunohost/yunohost-config/others/installed') return { 'Success' : _("YunoHost has been successfully configured") }