Bläddra i källkod

Revert "[core] WebHDFS octal permissions should be at most 4 digits"

This reverts commit d6b564426c58509350c9b4d033996a8c737e8c1a.
Romain Rigaux 13 år sedan
förälder
incheckning
17142a5

+ 0 - 11
desktop/libs/hadoop/src/hadoop/fs/test_webhdfs.py

@@ -28,7 +28,6 @@ from threading import Thread
 from hadoop import pseudo_hdfs4
 from hadoop.fs.exceptions import WebHdfsException
 from hadoop.fs.hadoopfs import Hdfs
-from hadoop.fs.webhdfs import safe_octal
 
 LOG = logging.getLogger(__name__)
 
@@ -238,13 +237,3 @@ def test_threadedness():
   assert_equals("alpha", fs.user)
   fs.setuser("gamma")
   assert_equals("gamma", fs.user)
-
-def test_safe_octal():
-  assert_equals('0777', safe_octal(0777))
-  assert_equals('0777', safe_octal(00777))
-  assert_equals('1777', safe_octal(01777))
-
-  assert_equals('777', safe_octal('777'))
-  assert_equals('0777', safe_octal('0777'))
-  assert_equals('1777', safe_octal('1777'))
-  assert_equals('1777', safe_octal('01777'))

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

@@ -582,17 +582,11 @@ def safe_octal(octal_value):
   safe_octal(octal_value) -> octal value in string
 
   This correctly handles octal values specified as a string or as a numeric.
-  Only the 4 rightmost digits are returned (e.g. 01777 becomes 1777).
   """
   try:
-    octal = oct(octal_value)
+    return oct(octal_value)
   except TypeError:
-    octal = str(octal_value)
-  if len(octal) > 4:
-    old_octal = octal
-    octal = octal[-4:]
-    LOG.warn('Octal %s was truncated to %s.' % (old_octal, octal))
-  return octal
+    return str(octal_value)
 
 
 def _get_service_url(hdfs_config):