[cluster] Protect against override of cluster name
@@ -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))
