浏览代码

HUE-5202 Disable extract uploaded archive using notebook connector by default

krish 9 年之前
父节点
当前提交
31a942d

+ 2 - 1
apps/filebrowser/src/filebrowser/views.py

@@ -68,6 +68,7 @@ from filebrowser.lib import xxd
 from filebrowser.forms import RenameForm, UploadFileForm, UploadArchiveForm, MkDirForm, EditorForm, TouchForm,\
 from filebrowser.forms import RenameForm, UploadFileForm, UploadArchiveForm, MkDirForm, EditorForm, TouchForm,\
                               RenameFormSet, RmTreeFormSet, ChmodFormSet, ChownFormSet, CopyFormSet, RestoreFormSet,\
                               RenameFormSet, RmTreeFormSet, ChmodFormSet, ChownFormSet, CopyFormSet, RestoreFormSet,\
                               TrashPurgeForm
                               TrashPurgeForm
+from notebook.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
 
 
 
 
 DEFAULT_CHUNK_SIZE_BYTES = 1024 * 4 # 4KB
 DEFAULT_CHUNK_SIZE_BYTES = 1024 * 4 # 4KB
@@ -1236,7 +1237,7 @@ def _upload_file(request):
         try:
         try:
             request.fs.upload(file=uploaded_file, path=dest, username=request.user.username)
             request.fs.upload(file=uploaded_file, path=dest, username=request.user.username)
             response['status'] = 0
             response['status'] = 0
-            if extract_archive:
+            if ENABLE_EXTRACT_UPLOADED_ARCHIVE.get() and extract_archive:
               response['batch_job_response'] = extract_archive_in_hdfs(request, dest, uploaded_file.name)
               response['batch_job_response'] = extract_archive_in_hdfs(request, dest, uploaded_file.name)
 
 
         except IOError, ex:
         except IOError, ex:

+ 2 - 0
apps/filebrowser/src/filebrowser/views_test.py

@@ -36,6 +36,7 @@ from desktop.lib.test_utils import grant_access, add_to_group
 from hadoop import pseudo_hdfs4
 from hadoop import pseudo_hdfs4
 from hadoop.conf import UPLOAD_CHUNK_SIZE
 from hadoop.conf import UPLOAD_CHUNK_SIZE
 from filebrowser.views import location_to_url
 from filebrowser.views import location_to_url
+from notebook.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
 
 
 from conf import MAX_SNAPPY_DECOMPRESSION_SIZE
 from conf import MAX_SNAPPY_DECOMPRESSION_SIZE
 from lib.rwx import expand_mode
 from lib.rwx import expand_mode
@@ -904,6 +905,7 @@ alert("XSS")
         pass
         pass
 
 
   def test_extract_uploaded_archive(self):
   def test_extract_uploaded_archive(self):
+    ENABLE_EXTRACT_UPLOADED_ARCHIVE.set_for_testing(True)
     prefix = self.cluster.fs_prefix + '/test_upload_zip'
     prefix = self.cluster.fs_prefix + '/test_upload_zip'
     self.cluster.fs.mkdir(prefix)
     self.cluster.fs.mkdir(prefix)
 
 

+ 3 - 0
desktop/conf.dist/hue.ini

@@ -622,6 +622,9 @@
   ## Flag to enable the creation of a coordinator for the current SQL query.
   ## Flag to enable the creation of a coordinator for the current SQL query.
   # enable_query_scheduling=false
   # enable_query_scheduling=false
 
 
+  ## Flag to enable the extraction of a uploaded archive in HDFS.
+  # enable_extract_uploaded_archive=false
+
   ## Base URL to Remote GitHub Server
   ## Base URL to Remote GitHub Server
   # github_remote_url=https://github.com
   # github_remote_url=https://github.com
 
 

+ 3 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -626,6 +626,9 @@
   ## Flag to enable the creation of a coordinator for the current SQL query.
   ## Flag to enable the creation of a coordinator for the current SQL query.
   # enable_query_scheduling=false
   # enable_query_scheduling=false
 
 
+  ## Flag to enable the extraction of a uploaded archive in HDFS.
+  # enable_extract_uploaded_archive=false
+
   ## Base URL to Remote GitHub Server
   ## Base URL to Remote GitHub Server
   # github_remote_url=https://github.com
   # github_remote_url=https://github.com
 
 

+ 7 - 0
desktop/libs/notebook/src/notebook/conf.py

@@ -102,6 +102,13 @@ ENABLE_QUERY_SCHEDULING = Config(
   default=False
   default=False
 )
 )
 
 
+ENABLE_EXTRACT_UPLOADED_ARCHIVE = Config(
+  key="enable_extract_uploaded_archive",
+  help=_t("Flag to enable the extraction of a uploaded archive in HDFS."),
+  type=bool,
+  default=False
+)
+
 ENABLE_BATCH_EXECUTE = Config(
 ENABLE_BATCH_EXECUTE = Config(
   key="enable_batch_execute",
   key="enable_batch_execute",
   help=_t("Flag to enable the bulk submission of queries as a background task through Oozie."),
   help=_t("Flag to enable the bulk submission of queries as a background task through Oozie."),