Pārlūkot izejas kodu

HUE-9112 [fs] Better exception logging when an upload fails

Romain 5 gadi atpakaļ
vecāks
revīzija
c058746ea2

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

@@ -1298,7 +1298,8 @@ def upload_file(request):
         resp = _upload_file(request)
         response.update(resp)
     except Exception as ex:
-        response['data'] = str(ex).split('\n', 1)[0]
+        logger.exception('Upload failure')
+        response['data'] = smart_str(ex).split('\n', 1)[0]
         hdfs_file = request.FILES.get('hdfs_file')
         if hdfs_file and hasattr(hdfs_file, 'remove'):  # TODO: Call from proxyFS
             hdfs_file.remove()
@@ -1330,7 +1331,6 @@ def _upload_file(request):
         try:
             request.fs.upload(file=uploaded_file, path=dest, username=request.user.username)
             response['status'] = 0
-
         except IOError as ex:
             already_exists = False
             try:

+ 0 - 1
desktop/core/src/desktop/lib/rest/resource.py

@@ -1,4 +1,3 @@
-from __future__ import division
 # Licensed to Cloudera, Inc. under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information

+ 1 - 2
desktop/libs/hadoop/src/hadoop/fs/webhdfs.py

@@ -472,8 +472,7 @@ class WebHdfs(Hdfs):
     headers = self._getheaders()
     result = self._root.put(old, params, headers=headers)
     if not result['boolean']:
-      raise IOError(_("Rename failed: %s -> %s") %
-                    (str(smart_str(old)), str(smart_str(new))))
+      raise IOError(_("Rename failed: %s -> %s") % (smart_str(old), smart_str(new)))
 
   def rename_star(self, old_dir, new_dir):
     """Equivalent to `mv old_dir/* new"""