From c2422d8c3eadba4ba655be98d57028d34ac7dc74 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 18 Jun 2020 19:14:30 +0200 Subject: [PATCH] Let's create the home after we validate that admin actually does exists --- src/yunohost/tools.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/yunohost/tools.py b/src/yunohost/tools.py index e341c76f1..b6d45b03c 100644 --- a/src/yunohost/tools.py +++ b/src/yunohost/tools.py @@ -104,14 +104,6 @@ def tools_ldapinit(): # Force nscd to refresh cache to take admin creation into account subprocess.call(['nscd', '-i', 'passwd']) - try: - # Attempt to create user home folder - subprocess.check_call(["mkhomedir_helper", "admin"]) - except subprocess.CalledProcessError: - if not os.path.isdir('/home/{0}'.format("admin")): - logger.warning(m18n.n('user_home_creation_failed'), - exc_info=1) - # Check admin actually exists now try: pwd.getpwnam("admin") @@ -119,6 +111,14 @@ def tools_ldapinit(): logger.error(m18n.n('ldap_init_failed_to_create_admin')) raise YunohostError('installation_failed') + try: + # Attempt to create user home folder + subprocess.check_call(["mkhomedir_helper", "admin"]) + except subprocess.CalledProcessError: + if not os.path.isdir('/home/{0}'.format("admin")): + logger.warning(m18n.n('user_home_creation_failed'), + exc_info=1) + logger.success(m18n.n('ldap_initialized'))