Эх сурвалжийг харах

HUE-9112 [hdfs] Avoid potential log trace failure similarly to Resource

If one of the path truly can't be printed as is, better to sanitize it
so that the exception is properly raised instead of creating a different
failure.
Romain 5 жил өмнө
parent
commit
56b05cc00a

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

@@ -47,8 +47,7 @@ from hadoop.fs.webhdfs_types import WebHdfsStat, WebHdfsContentSummary
 from hadoop.hdfs_site import get_nn_sentry_prefixes, get_umask_mode, get_supergroup, get_webhdfs_ssl
 from hadoop.hdfs_site import get_nn_sentry_prefixes, get_umask_mode, get_supergroup, get_webhdfs_ssl
 
 
 if sys.version_info[0] > 2:
 if sys.version_info[0] > 2:
-  from urllib.parse import unquote as urllib_quote
-  from urllib.parse import urlparse
+  from urllib.parse import unquote as urllib_quote, urlparse
 else:
 else:
   from urllib import unquote as urllib_quote
   from urllib import unquote as urllib_quote
   from urlparse import urlparse
   from urlparse import urlparse
@@ -472,7 +471,7 @@ class WebHdfs(Hdfs):
     headers = self._getheaders()
     headers = self._getheaders()
     result = self._root.put(old, params, headers=headers)
     result = self._root.put(old, params, headers=headers)
     if not result['boolean']:
     if not result['boolean']:
-      raise IOError(_("Rename failed: %s -> %s") % (smart_str(old), smart_str(new)))
+      raise IOError(_("Rename failed: %s -> %s") % (smart_str(old, errors='replace'), smart_str(new, errors='replace')))
 
 
   def rename_star(self, old_dir, new_dir):
   def rename_star(self, old_dir, new_dir):
     """Equivalent to `mv old_dir/* new"""
     """Equivalent to `mv old_dir/* new"""