Browse Source

HUE-8591 [cluster] Protect against override of cluster name

Romain Rigaux 7 years ago
parent
commit
8fbe00ad87
1 changed files with 2 additions and 2 deletions
  1. 2 2
      apps/beeswax/src/beeswax/server/dbms.py

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

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