Forráskód Böngészése

[core][compute] fixed username for query execution

The current logged in user's username was not being sent to Hive/Impala
and instead `hive` was going out. This commit fixes it and sets the
correct username.

Change-Id: Ifd8dbc8d716dfe2000fbfa8121e39f2610051fa1
Amit Srivastava 2 éve
szülő
commit
c5374cbdc4
1 módosított fájl, 5 hozzáadás és 1 törlés
  1. 5 1
      apps/beeswax/src/beeswax/server/dbms.py

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

@@ -101,7 +101,9 @@ def get(user, query_server=None, cluster=None):
   if query_server is None:
     query_server = get_query_server_config(connector=cluster)
 
-  if not query_server.get('auth_username'):
+  # if the auth_username is not set then we attempt to set using the current user
+  # this is likely to be the case when using connectors/computes
+  if not query_server.get('auth_username') and user and user.username:
     query_server['auth_username'] = user.username
 
   DBMS_CACHE_LOCK.acquire()
@@ -333,6 +335,8 @@ def get_query_server_config_via_connector(connector):
       'server_name': compute_name,
       'server_host': server_host,
       'server_port': server_port,
+      # For connectors/computes, the auth details are not available
+      # from configs and needs patching before submitting requests
       'principal': 'TODO',
       'auth_username': None,
       'auth_password': '',