瀏覽代碼

HUE-4406 [core] Fails to start if Hive/Impala Not Installed

Jenny Kim 9 年之前
父節點
當前提交
ba1d7c7
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      desktop/libs/notebook/src/notebook/connectors/hiveserver2.py

+ 6 - 1
desktop/libs/notebook/src/notebook/connectors/hiveserver2.py

@@ -49,6 +49,7 @@ try:
   from beeswax.views import _parse_out_hadoop_jobs
 except ImportError, e:
   LOG.warn('Hive and HiveServer2 interfaces are not enabled')
+  hive_settings = None
 
 try:
   from impala import api   # Force checking if Impala is enabled
@@ -80,6 +81,10 @@ def query_error_handler(func):
   return decorator
 
 
+def is_hive_enabled():
+  return hive_settings is not None and type(hive_settings) == BoundConfig
+
+
 def is_impala_enabled():
   return impala_settings is not None and type(impala_settings) == BoundConfig
 
@@ -113,7 +118,7 @@ class HiveConfiguration(object):
       "key": "settings",
       "help_text": _("Hive and Hadoop configuration properties."),
       "type": "settings",
-      "options": [config.lower() for config in hive_settings.get()] if hasattr(hive_settings, 'get') else []
+      "options": [config.lower() for config in hive_settings.get()] if is_hive_enabled() and hasattr(hive_settings, 'get') else []
     }
   ]