Пример #1
0
 def rename(self, old, new):
     """rename(old, new)"""
     old = Hdfs.normpath(old)
     if not new.startswith("/"):
         new = Hdfs.join(Hdfs.dirname(old), new)
     new = Hdfs.normpath(new)
     params = self._getparams()
     params["op"] = "RENAME"
     # Encode `new' because it's in the params
     params["destination"] = smart_str(new)
     result = self._root.put(old, params)
     if not result["boolean"]:
         raise IOError("Rename failed: %s -> %s" % (smart_str(old), smart_str(new)))
Пример #2
0
 def rename(self, old, new):
   """rename(old, new)"""
   old = self.strip_normpath(old)
   if not self.is_absolute(new):
     new = Hdfs.join(Hdfs.dirname(old), new)
   new = self.strip_normpath(new)
   params = self._getparams()
   params['op'] = 'RENAME'
   # Encode `new' because it's in the params
   params['destination'] = smart_str(new)
   headers = self._getheaders()
   result = self._root.put(old, params, headers=headers)
   if not result['boolean']:
     raise IOError(_("Rename failed: %s -> %s") % (smart_str(old, errors='replace'), smart_str(new, errors='replace')))
Пример #3
0
 def rename(self, old, new):
   """rename(old, new)"""
   old = Hdfs.normpath(old)
   if not new.startswith('/'):
     new = Hdfs.join(Hdfs.dirname(old), new)
   new = Hdfs.normpath(new)
   params = self._getparams()
   params['op'] = 'RENAME'
   # Encode `new' because it's in the params
   params['destination'] = smart_str(new)
   result = self._root.put(old, params)
   if not result['boolean']:
     raise IOError(_("Rename failed: %s -> %s") %
                   (str(smart_str(old)), str(smart_str(new))))