Browse Source

HUE-8591 [cluster] Use default port if ont in a selected remote cluster

Romain Rigaux 7 years ago
parent
commit
0fe3c21

+ 1 - 1
apps/beeswax/src/beeswax/server/dbms.py

@@ -91,7 +91,7 @@ def get_query_server_config(name='beeswax', server=None, cluster=None):
   # Safeguard
   if not cluster or cluster == 'localhost':
     api = DataWarehouse2Api(None)
-    clusters = api.list_clusters()
+    clusters = [cluster for cluster in api.list_clusters() and cluster['status'] == 'ONLINE']
     cluster_config = {'server_host': clusters['clusters'][0]['coordinatorEndpoint']['publicHost'], 'name': clusters['clusters'][0]['name']}
     LOG.debug("Cluster was localhost: %s" % repr(cluster_config))
 

+ 1 - 1
apps/impala/src/impala/dbms.py

@@ -35,7 +35,7 @@ def get_query_server_config(cluster_config=None):
   query_server = {
         'server_name': 'impala' + ('-' + cluster_config.get('name') if cluster_config else ''),
         'server_host': conf.SERVER_HOST.get() if not cluster_config else cluster_config.get('server_host'),
-        'server_port': 21000, #conf.SERVER_PORT.get(),
+        'server_port': conf.SERVER_PORT.get() if not cluster_config else 21000,
         'principal': conf.IMPALA_PRINCIPAL.get(),
         'impersonation_enabled': conf.IMPERSONATION_ENABLED.get(),
         'querycache_rows': conf.QUERYCACHE_ROWS.get(),

+ 2 - 2
desktop/core/src/desktop/api2.py

@@ -115,7 +115,7 @@ def get_context_namespaces(request, interface):
         sdx_namespaces = SdxApi(request.user).list_namespaces()
 
       # Adding "fake" namespace for cluster without one
-      sdx_namespaces.extend([_cluster for _cluster in adb_clusters if not _cluster.get('namespaceCrn') or IS_K8_ONLY.get()])
+      sdx_namespaces.extend([_cluster for _cluster in adb_clusters if not _cluster.get('namespaceCrn') or (IS_K8_ONLY.get() and _cluster['status'] == 'ONLINE')])
 
       namespaces.extend([{
           'id': namespace.get('crn', 'None'),
@@ -162,7 +162,7 @@ def get_context_computes(request, interface):
           'namespace': cluster.get('namespaceCrn', cluster.get('crn')),
           'impalad_host': IS_K8_ONLY.get() and '%(publicHost)s' % cluster['coordinatorEndpoint'] or '',
           'type': 'altus-dw'
-        } for cluster in dw_clusters if (cluster.get('status') == 'CREATED' and cluster.get('cdhVersion') >= 'CDH515') or IS_K8_ONLY.get()]
+        } for cluster in dw_clusters if (cluster.get('status') == 'CREATED' and cluster.get('cdhVersion') >= 'CDH515') or (IS_K8_ONLY.get() and cluster['status'] == 'ONLINE')]
       )
 
   if interface == 'oozie' or interface == 'spark2':