예제 #1
0
def _convert_bucket_to_cbObject(user, file):
    tm = file.get_creation_time()
    size = -1
    key = file.get_name()
    display_name = file.get_name()
    obj = cbObject(tm, size, key, display_name, user)
    return obj
예제 #2
0
def _convert_bucket_to_cbObject(user, file):
    tm = file.get_creation_time()
    size = -1 
    key = file.get_name()
    display_name = file.get_name()
    obj = cbObject(tm, size, key, display_name, user)
    return obj
예제 #3
0
def _convert_bucket_to_cbObject(user, file):
    pycb.log(logging.INFO, "===== def _convert_bucket_to_cbObject of cbAuthzSecurity.py")
    tm = file.get_creation_time()
    size = -1 
    key = file.get_name()
    display_name = file.get_name()
    obj = cbObject(tm, size, key, display_name, user)
    return obj
예제 #4
0
def _convert_File_to_cbObject(user, file):
    data_key = file.get_data_key()
    size = file.get_size()
    tm = file.get_creation_time()
    mds = file.get_md5sum()
    key = file.get_name()
    display_name = file.get_name()
    # should file meta info come from here or backend?
    obj = cbObject(tm, size, key, display_name, user, md5sum=mds)
    return obj
예제 #5
0
def _convert_File_to_cbObject(user, file):
    data_key = file.get_data_key()
    size = file.get_size()
    tm = file.get_creation_time()
    mds = file.get_md5sum()
    key = file.get_name()
    display_name = file.get_name()
    # should file meta info come from here or backend?
    obj = cbObject(tm, size, key, display_name, user, md5sum=mds)
    return obj
예제 #6
0
def _convert_File_to_cbObject(user, file):
    pycb.log(logging.INFO, "===== def _convert_File_to_cbObject of cbAuthzSecurity.py")
    data_key = file.get_data_key()
    size = file.get_size()
    tm = file.get_creation_time()
    mds = file.get_md5sum()
    key = file.get_name()
    display_name = file.get_name()
    # should file meta info come from here or backend?
    obj = cbObject(tm, size, key, display_name, user, md5sum=mds)
    return obj
예제 #7
0
    def list_bucket(self, bucketIface, bucketName, args):
        pycb.log(logging.INFO, "===== def list_bucket of cbPosixSecurity.py")
        d = self.getBucketDir(bucketName)
        if not os.path.isdir(d):
            pycb.log(logging.ERROR, "did not find %s" %(d))
            raise cbException('NoSuchBucket')

        if 'prefix' in args:
            p = args['prefix'][0]
            p = self.hashFile(p)
            prefix = d + "/" + p + "*"
        else:
            prefix = d + "/" + "*"

        dir_list = glob.glob(prefix)
        if 'max-keys' in args:
            max_a = args['max-keys']
            max = int(max_a[0])
        else:
            max = len(dir_list) + 1

        results = []
        for f in dir_list:
            if len(results) >= max:
                break

            file = f.replace(d, "")
            st = os.stat(f)
            if stat.S_ISREG(st.st_mode):
                # XXX just pick the size of the first one
                dir_list = os.listdir(d)
                if len(dir_list) > 0:
                    data_key = self.getDataKey(d+"/"+dir_list[0])
                    size = bucketIface.getSize(data_key)
                    tm = bucketIface.getModTime(data_key)
                    key = self.unhashFile(file)
                    display_name = key
                    obj = cbObject(tm, size, key, display_name, self)
                    results.append(obj)

        return results
예제 #8
0
    def get_my_buckets(self):
        d = getPosixBuckerMetaDir()
        dir_list = os.listdir(d)

        results = []
        for f in dir_list:
            file = d + "/" + f
            st = os.stat(file)
            tm = time.gmtime(st.st_ctime)
            size = -1
            try:
                if self.isOwner(f):
                    mds = bucketIFace.getMD5(data_key)
                    obj = cbObject(tm, size, f, f, self, md5sum=mds)
                    results.append(obj)
            except:
                traceback.print_exc(file=sys.stdout)
                pycb.log(logging.WARNING, "error checking ownership of %s" % (f), tb=traceback)


        return results
예제 #9
0
    def list_bucket(self, bucketIface, bucketName, args):
        d = self.getBucketDir(bucketName)
        if not os.path.isdir(d):
            pycb.log(logging.ERROR, "did not find %s" % (d))
            raise cbException('NoSuchBucket')

        if 'prefix' in args:
            p = args['prefix'][0]
            p = self.hashFile(p)
            prefix = d + "/" + p + "*"
        else:
            prefix = d + "/" + "*"

        dir_list = glob.glob(prefix)
        if 'max-keys' in args:
            max_a = args['max-keys']
            max = int(max_a[0])
        else:
            max = len(dir_list) + 1

        results = []
        for f in dir_list:
            if len(results) >= max:
                break

            file = f.replace(d, "")
            st = os.stat(f)
            if stat.S_ISREG(st.st_mode):
                # XXX just pick the size of the first one
                dir_list = os.listdir(d)
                if len(dir_list) > 0:
                    data_key = self.getDataKey(d + "/" + dir_list[0])
                    size = bucketIface.getSize(data_key)
                    tm = bucketIface.getModTime(data_key)
                    key = self.unhashFile(file)
                    display_name = key
                    obj = cbObject(tm, size, key, display_name, self)
                    results.append(obj)

        return results
예제 #10
0
    def get_my_buckets(self):
        d = getPosixBuckerMetaDir()
        dir_list = os.listdir(d)

        results = []
        for f in dir_list:
            file = d + "/" + f
            st = os.stat(file)
            tm = time.gmtime(st.st_ctime)
            size = -1
            try:
                if self.isOwner(f):
                    mds = bucketIFace.getMD5(data_key)
                    obj = cbObject(tm, size, f, f, self, md5sum=mds)
                    results.append(obj)
            except:
                traceback.print_exc(file=sys.stdout)
                pycb.log(logging.WARNING,
                         "error checking ownership of %s" % (f),
                         tb=traceback)

        return results