Эх сурвалжийг харах

HUE-8579 [core] Blacklisting certain apps like filebrowser and oozie can fail

Romain Rigaux 7 жил өмнө
parent
commit
03e2acc

+ 1 - 2
apps/jobbrowser/src/jobbrowser/apis/bundle_api.py

@@ -25,7 +25,6 @@ from liboozie.oozie_api import get_oozie
 from jobbrowser.apis.base_api import Api, MockDjangoRequest
 from jobbrowser.apis.workflow_api import _manage_oozie_job, _filter_oozie_jobs
 from jobbrowser.apis.schedule_api import MockGet
-from oozie.views.dashboard import list_oozie_bundle
 
 
 LOG = logging.getLogger(__name__)
@@ -33,7 +32,7 @@ LOG = logging.getLogger(__name__)
 
 try:
   from oozie.conf import OOZIE_JOBS_COUNT
-  from oozie.views.dashboard import get_oozie_job_log, massaged_oozie_jobs_for_json
+  from oozie.views.dashboard import get_oozie_job_log, massaged_oozie_jobs_for_json, list_oozie_bundle
 except Exception, e:
   LOG.exception('Some application are not enabled: %s' % e)
 

+ 1 - 1
apps/jobbrowser/src/jobbrowser/apis/schedule_api.py

@@ -34,7 +34,7 @@ try:
   from oozie.conf import OOZIE_JOBS_COUNT
   from oozie.views.dashboard import list_oozie_coordinator, get_oozie_job_log, massaged_oozie_jobs_for_json, has_job_edition_permission
 except Exception, e:
-  LOG.exception('Some application are not enabled: %s' % e)
+  LOG.warn('Some application are not enabled: %s' % e)
 
 
 class ScheduleApi(Api):

+ 5 - 3
apps/jobbrowser/src/jobbrowser/apis/workflow_api.py

@@ -32,8 +32,10 @@ try:
   from oozie.conf import OOZIE_JOBS_COUNT, ENABLE_OOZIE_BACKEND_FILTERING
   from oozie.views.dashboard import get_oozie_job_log, list_oozie_workflow, manage_oozie_jobs, bulk_manage_oozie_jobs, has_dashboard_jobs_access, massaged_oozie_jobs_for_json, \
       has_job_edition_permission
+  has_oozie_installed = True
 except Exception, e:
-  LOG.exception('Some applications are not enabled for Job Browser v2: %s' % e)
+  LOG.warn('Some applications are not enabled for Job Browser v2: %s' % e)
+  has_oozie_installed = False
 
 
 class WorkflowApi(Api):
@@ -200,7 +202,7 @@ def _manage_oozie_job(user, action, app_ids):
 def _filter_oozie_jobs(user, filters, kwargs):
     text_filters = _extract_query_params(filters)
 
-    if not has_dashboard_jobs_access(user):
+    if has_oozie_installed and not has_dashboard_jobs_access(user):
       kwargs['filters'].append(('user', user.username))
     elif 'username' in text_filters:
       kwargs['filters'].append(('user', text_filters['username']))
@@ -208,7 +210,7 @@ def _filter_oozie_jobs(user, filters, kwargs):
     if 'time' in filters:
       kwargs['filters'].extend([('startcreatedtime', '-%s%s' % (filters['time']['time_value'], filters['time']['time_unit'][:1]))])
 
-    if hasattr(ENABLE_OOZIE_BACKEND_FILTERING, 'get') and ENABLE_OOZIE_BACKEND_FILTERING.get() and text_filters.get('text'):
+    if has_oozie_installed and ENABLE_OOZIE_BACKEND_FILTERING.get() and text_filters.get('text'):
       kwargs['filters'].extend([('text', text_filters.get('text'))])
 
     if filters['pagination']:

+ 1 - 1
desktop/core/src/desktop/configuration/api.py

@@ -34,7 +34,7 @@ from notebook.connectors.spark_shell import SparkConfiguration
 
 try:
   from oozie.models2 import WorkflowConfiguration as OozieWorkflowConfiguration
-except ImportError, e:
+except (ImportError, RuntimeError), e:
   OozieWorkflowConfiguration = None
 
 

+ 1 - 1
desktop/core/src/desktop/models.py

@@ -1779,7 +1779,7 @@ class ClusterConfig():
         'page': '/metastore/tables'
       })
 
-    if 'indexer' in self.apps and self.cluster_type != ANALYTIC_DB:
+    if 'search' in self.apps and self.cluster_type != ANALYTIC_DB:
       interpreters.append({
         'type': 'indexes',
         'displayName': _('Indexes'),

+ 4 - 4
desktop/core/src/desktop/templates/assist.mako

@@ -491,7 +491,7 @@ from desktop.views import _ko
   <script type="text/html" id="assist-hdfs-header-actions">
     <div class="assist-db-header-actions">
       <a class="inactive-action" href="javascript:void(0)" data-bind="click: goHome" title="Go to ${ home_dir }"><i class="pointer fa fa-home"></i></a>
-      % if SHOW_UPLOAD_BUTTON.get():
+      % if hasattr(SHOW_UPLOAD_BUTTON, 'get') and SHOW_UPLOAD_BUTTON.get():
       <a class="inactive-action" data-bind="dropzone: {
             url: '/filebrowser/upload/file?dest=' + path,
             params: { dest: path },
@@ -508,7 +508,7 @@ from desktop.views import _ko
   <script type="text/html" id="assist-adls-header-actions">
     <div class="assist-db-header-actions">
       <a class="inactive-action" href="javascript:void(0)" data-bind="click: goHome" title="Go to ${ home_dir }"><i class="pointer fa fa-home"></i></a>
-      % if SHOW_UPLOAD_BUTTON.get():
+      % if hasattr(SHOW_UPLOAD_BUTTON, 'get') and SHOW_UPLOAD_BUTTON.get():
       <a class="inactive-action" data-bind="dropzone: {
             url: '/filebrowser/upload/file?dest=adl:' + path,
             params: { dest: path },
@@ -646,7 +646,7 @@ from desktop.views import _ko
       <span class="dropdown new-document-drop-down">
 
         <a class="inactive-action dropdown-toggle" data-toggle="dropdown" data-bind="dropdown" href="javascript:void(0);">
-             <i class="pointer fa fa-plus" title="${ _('New document') }"></i>
+          <i class="pointer fa fa-plus" title="${ _('New document') }"></i>
         </a>
         <ul class="dropdown-menu less-padding document-types" style="margin-top:3px; margin-left:-140px; width: 175px;position: absolute;" role="menu">
             % if 'beeswax' in apps:
@@ -1069,7 +1069,7 @@ from desktop.views import _ko
   </script>
 
   <script type="text/html" id="assist-panel-template">
-    <div class="assist-panel" data-bind="dropzone: { url: '/filebrowser/upload/file?dest=' + DROPZONE_HOME_DIR, params: {dest: DROPZONE_HOME_DIR}, paramName: 'hdfs_file', onComplete: function(path){ huePubSub.publish('assist.dropzone.complete', path); }, disabled: '${ not SHOW_UPLOAD_BUTTON.get() }' === 'True' }">
+    <div class="assist-panel" data-bind="dropzone: { url: '/filebrowser/upload/file?dest=' + DROPZONE_HOME_DIR, params: {dest: DROPZONE_HOME_DIR}, paramName: 'hdfs_file', onComplete: function(path){ huePubSub.publish('assist.dropzone.complete', path); }, disabled: '${ not (hasattr(SHOW_UPLOAD_BUTTON, 'get') and SHOW_UPLOAD_BUTTON.get()) }' === 'True' }">
       <!-- ko if: availablePanels().length > 1 -->
       <div class="assist-panel-switches">
         <!-- ko foreach: availablePanels -->

+ 2 - 2
desktop/core/src/desktop/templates/common_header.mako

@@ -261,8 +261,8 @@ ${ hueIcons.symbols() }
     found_app = ""
     for app in app_list:
       if app in apps:
-       found_app = app
-       count += 1
+        found_app = app
+        count += 1
     return found_app, count
 %>
 % if not skip_topbar:

+ 1 - 1
desktop/core/src/desktop/templates/hue.mako

@@ -321,7 +321,7 @@ ${ hueIcons.symbols() }
           <!-- /ko -->
         </div>
         <div class="hue-sidebar-footer-panel">
-          % if SHOW_UPLOAD_BUTTON.get():
+          % if hasattr(SHOW_UPLOAD_BUTTON, 'get') and SHOW_UPLOAD_BUTTON.get():
           <div data-bind="dropzone: {
             clickable: false,
             url: '/filebrowser/upload/file?dest=' + DROPZONE_HOME_DIR,

+ 1 - 0
desktop/libs/notebook/src/notebook/conf.py

@@ -137,6 +137,7 @@ ENABLE_QUERY_BUILDER = Config(
   default=True
 )
 
+# Note: requires Oozie app
 ENABLE_QUERY_SCHEDULING = Config(
   key="enable_query_scheduling",
   help=_t("Flag to enable the creation of a coordinator for the current SQL query."),