예제 #1
0
 def listdir_stats(self, path, params=None, **kwargs):
     """
 List the stats for the directories inside the specified path
 Returns the Multiple ABFFStat object #note change later for recursive cases
 """
     if ABFS.isroot(path):
         return self.listfilesystems_stats(params=None, **kwargs)
     dir_stats = []
     file_system, directory_name, account = Init_ABFS.parse_uri(path)
     root = Init_ABFS.ABFS_ROOT
     if path.lower().startswith(Init_ABFS.ABFS_ROOT_S):
         root = Init_ABFS.ABFS_ROOT_S
     if params is None:
         params = {}
     if 'recursive' not in params:
         params['recursive'] = 'false'
     params['resource'] = 'filesystem'
     if directory_name != "":
         params['directory'] = directory_name
     res = self._root._invoke("GET",
                              file_system,
                              params,
                              headers=self._getheaders(),
                              **kwargs)
     resp = self._root._format_response(res)
     if account != '':
         file_system = file_system + account
     for x in resp['paths']:
         dir_stats.append(
             ABFSStat.for_directory(res.headers, x,
                                    root + file_system + "/" + x['name']))
     return dir_stats
예제 #2
0
파일: abfs.py 프로젝트: sandredd/hue-1
 def listdir_stats(self, path, params=None, **kwargs):
     """
 List the stats for the directories inside the specified path
 Returns the Multiple ABFFStat object #note change later for recursive cases
 """
     if ABFS.isroot(path):
         LOG.warn("Path: %s is a Filesystem" % path)
         return self.listfilesystems_stats(params=None, **kwargs)
     dir_stats = []
     file_system, directory_name = Init_ABFS.parse_uri(path)[:2]
     if params is None:
         params = {}
     if 'recursive' not in params:
         params['recursive'] = 'false'
     params['resource'] = 'filesystem'
     if directory_name != "":
         params['directory'] = directory_name
     res = self._root._invoke("GET",
                              file_system,
                              params,
                              headers=self._getheaders(),
                              **kwargs)
     resp = self._root._format_response(res)
     for x in resp['paths']:
         dir_stats.append(
             ABFSStat.for_directory(
                 res.headers, x,
                 Init_ABFS.ABFS_ROOT + file_system + "/" + x['name']))
     return dir_stats