示例#1
0
    def dir_list(self, dir_obj, pattern):
        
        complete_path = dir_obj._url.path
        result = []

        try:
            self.log_info("Trying to LSDIR '%s'" % (complete_path))

            dir = lfc.lfc_opendir(complete_path)
            if dir == None:
                raise Exception('Could not open dir')

            while True:
                entry = lfc.lfc_readdirxr(dir)
                if entry == None:
                    break
                result.append(entry.d_name)

            lfc.lfc_closedir(dir)

        except Exception, ex:
            self.log_error_and_raise(bliss.saga.Error.NoSuccess,
            "Couldn't list directory: %s " % (str(ex)))
示例#2
0
                    # print("Get Replicate list [%d] elements\n"%entry.nbreplicas)
                    reps = []
                    for i in range(entry.nbreplicas):
                        reps.append(entry.rep[i].sfn)
                    element["Replicas"] = reps

                fileList.append(element)

                # print("Next ...\n")
                entry = lfc.lfc_readdirxr(dirRef)

        except Exception, e:
            print("Exception [%s] : %s" % (str(type(e)), str(e)))

        lfc.lfc_closedir(dirRef)
        return fileList

    def getacl(path):
        # print("Get acl for %s" % path)
        acl = {}
        # Default value
        acl["owner_perm"] = "???"
        acl["owner"] = "unknown"
        acl["group_perm"] = "???"
        acl["group"] = "unknown"
        acl["others_perm"] = "???"

        acls_list = lfc.lfc_getacl(path)
        for i in acls_list:
            try:
示例#3
0
if len(sys.argv) < 2:
        print "Syntax: %s <LFC_directory>" % sys.argv[0]
        sys.exit(-1)

name = sys.argv[1]

dir = lfc.lfc_opendir(name)
if (dir == None) or (dir == 0):
        print  "Error  while  looking  for  " + name + ": No such a file or directory"
        sys.exit(1)

try:
        while 1:
                entry = lfc.lfc_readdirxr(dir)
                if entry == None:
                        break
                print entry.d_name
                if stat.S_ISDIR(entry.filemode):
                        print " ==> Directory"
                else:
                        print "GUID : %s" % entry.guid
                        for i in range(entry.nbreplicas):
                                print " ==> %s" % entry.rep[i].sfn

        lfc.lfc_closedir(dir)
except TypeError, x:
        print " ==> None"
except Exception:
        traceback.print_exc()
        sys.exit(1)