소스 검색

HUE-9077 [connector] Protect boot against when no fs is configured

In setups without any FS:
e.g. When there is no HDFS or S3 or FileBrowser is blacklisted.
Romain 6 년 전
부모
커밋
7761991010
2개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 0
      apps/useradmin/src/useradmin/views.py
  2. 1 1
      desktop/core/src/desktop/lib/fsmanager.py

+ 4 - 0
apps/useradmin/src/useradmin/views.py

@@ -825,6 +825,10 @@ def ensure_home_directory(fs, user):
 
 
   Throws IOError, WebHdfsException.
   Throws IOError, WebHdfsException.
   """
   """
+  if fs is None:
+    LOG.warn("Not creating home directory of %s as no file system connector is configured" % user)
+    return
+
   userprofile = get_profile(user)
   userprofile = get_profile(user)
   username = user.username
   username = user.username
   home_directory = userprofile.home_directory
   home_directory = userprofile.home_directory

+ 1 - 1
desktop/core/src/desktop/lib/fsmanager.py

@@ -142,7 +142,7 @@ def get_filesystem(name='default'):
   for fs in SUPPORTED_FS:
   for fs in SUPPORTED_FS:
     if is_enabled(fs):
     if is_enabled(fs):
       pdict[fs] = _get_client(fs)
       pdict[fs] = _get_client(fs)
-  return ProxyFS(pdict, get_default_schema(), name)
+  return ProxyFS(pdict, get_default_schema(), name) if pdict else None
 
 
 
 
 def get_filesystems(user):
 def get_filesystems(user):