From f577b8efc3da212dcf86c21d1c75d62423433229 Mon Sep 17 00:00:00 2001 From: Luca Natali Date: Tue, 11 Nov 2014 18:24:17 +0000 Subject: [PATCH] [auth] Force creating a home directory if a user already has a profile with it When a new cluster is attached to an existing external database for authenticating users, the new HDFS doesn't have users' home directories, which causes some service to fail (notably Oozie). --- desktop/core/src/desktop/auth/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/desktop/core/src/desktop/auth/views.py b/desktop/core/src/desktop/auth/views.py index 0ce8f6c..ed2a48e 100644 --- a/desktop/core/src/desktop/auth/views.py +++ b/desktop/core/src/desktop/auth/views.py @@ -35,6 +35,7 @@ from django.contrib.sessions.models import Session from django.http import HttpResponseRedirect from django.utils.translation import ugettext as _ from hadoop.fs.exceptions import WebHdfsException +from useradmin.models import get_profile from useradmin.views import ensure_home_directory from desktop.auth import forms as auth_forms @@ -110,7 +111,9 @@ def dt_login(request): if request.session.test_cookie_worked(): request.session.delete_test_cookie() - if is_first_login_ever or backend_name in ('AllowAllBackend', 'LdapBackend'): + profile = get_profile(user) + if is_first_login_ever or backend_name in ('AllowAllBackend', 'LdapBackend') \ + or (profile and profile.home_directory): # Create home directory for first user. try: ensure_home_directory(request.fs, user.username) -- 1.9.3 (Apple Git-50)