Răsfoiți Sursa

HUE-9029 [hive] Workaround Hive on Tez not performing HDFS impersonation

Keep it compatible with Impala impersonation like before, but might be
simpler to remove it and only use a /tmp folder.
Romain 6 ani în urmă
părinte
comite
26a85c926b

+ 12 - 9
apps/beeswax/src/beeswax/management/commands/beeswax_install_examples.py

@@ -261,21 +261,24 @@ class SampleTable(object):
   def _get_hdfs_root_destination(self, django_user, subdir=None):
     fs = cluster.get_hdfs()
     hdfs_root_destination = None
+    can_impersonate_hdfs = False
+
     if self.app_name == 'impala':
-      # Because Impala does not have impersonation on by default, we use a public destination for the upload.
+      # Impala can support impersonation, so use home instead of a public destination for the upload
       from impala.conf import IMPERSONATION_ENABLED
-      if not IMPERSONATION_ENABLED.get():
-        tmp_public = '/tmp/public_hue_examples'
-        if subdir:
-          tmp_public += '/%s' % subdir
-        fs.do_as_user(django_user, fs.mkdir, tmp_public, '0777')
-        hdfs_root_destination = tmp_public
-
-    if hdfs_root_destination is None:
+      can_impersonate_hdfs = IMPERSONATION_ENABLED.get()
+
+    if can_impersonate_hdfs:
       hdfs_root_destination = fs.do_as_user(django_user, fs.get_home_dir)
       if subdir:
         hdfs_root_destination += '/%s' % subdir
         fs.do_as_user(django_user, fs.mkdir, hdfs_root_destination, '0777')
+    else:
+      tmp_public = '/tmp/public_hue_examples'
+      if subdir:
+        tmp_public += '/%s' % subdir
+      fs.do_as_user(django_user, fs.mkdir, tmp_public, '0777')
+      hdfs_root_destination = tmp_public
 
     return hdfs_root_destination