コード例 #1
0
ファイル: qsplit.py プロジェクト: Qumulo/qsplit
    def process_folder(self, path):

        try:
            response = fs.read_entire_directory(self.connection, self.credentials, page_size=1000, path=path)
        except Exception, excpt:
            print "Error in read_entire_directory: %s" % excpt
            sys.exit(1)
コード例 #2
0
ファイル: qsplit.py プロジェクト: nivfreak/qsplit
    def process_folder(self, path):

        try:
            response = fs.read_entire_directory(self.connection,
                                                self.credentials,
                                                page_size=1000,
                                                path=path)
        except Exception, excpt:
            print "Error in read_entire_directory: %s" % excpt
            sys.exit(1)
コード例 #3
0
    def process_folder(self, path):

        try:
            response = fs.read_entire_directory(self.connection, 
                                                self.credentials, 
                                                page_size=1000, 
                                                path=path,
                                                snapshot=self.snap['id'] if self.snap is not None else None)
        except Exception as excpt:
            print("Error in read_entire_directory: %s" % excpt)
            sys.exit(1)

        for r in response:
            if self.verbose:
                print("processing " + str(len(r.data['files'])) + " in path " + path)
            self.process_folder_contents(r.data['files'], path)
            self.items_iterated_count += 1
コード例 #4
0
ファイル: qfindlogs.py プロジェクト: carlilek/qfind
def get_dir_info(conninfo, creds, sourcepath, monthago):
    dir_attrs = []
    contents_files = []
    contents_dirs = []
    logfiles = {}
    all_dir_attrs = fs.read_entire_directory(conninfo,
                                             creds,
                                             page_size=100000000,
                                             path=sourcepath)
    for dir_attrs in all_dir_attrs:
        item_attrs = dir_attrs.lookup("files")
        for item in item_attrs:
            if item["type"] == "FS_FILE_TYPE_DIRECTORY":
                contents_dirs.append(item)
            if ".log" in item["name"]:
                logattr = fs.get_file_attr(conninfo, creds, path=item["path"])
                if monthago > arrow.get(logattr[0]["modification_time"]):
                    logfiles[item["path"]] = logattr[0]["size"]
    return contents_dirs, logfiles
コード例 #5
0
ファイル: test_qacls_push.py プロジェクト: Qumulo/qacls
 def test_process_directory_contents_without_login(self):
     # TODO: Fix this test (and others) to create/destroy test trees
     sys.argv = ['./qacls_push.py', '/', '-a', 'ACE_NFSNOBODY_RW']
     #test_file_names = ['a', 'b', 'c', 'd']
     Q = qacls_push.QaclsCommand()
     # fs.create_directory(Q.connection, Q.credentials, 'test_dir', '/')
     # for foo in test_file_names:
     #     fs.create_file(Q.connection, Q.credentials, foo, '/test_dir/')
     response = fs.read_entire_directory(Q.connection,
                                         Q.credentials,
                                         page_size=5000,
                                         path='/test_dir')
     print response
     print Q.credentials.bearer_token
     print Q.start_path
     r_list = []
     for r in response:
         r_list.append(r)
     print r_list
     Q.credentials.bearer_token = 'borked'
     Q.process_directory_contents(r.data['files'], '/test_dir/')
コード例 #6
0
        connection = qumulo.lib.request.Connection(\
                            host, port)
        login_results, _ = qumulo.rest.auth.login(\
                connection, None, user, passwd)

        credentials = qumulo.lib.auth.Credentials.\
                from_login_response(login_results)

    except Exception, excpt:
        print "Error connecting to the REST server: %s" % excpt
        print __doc__
        # TODO: Raise error
        return False

    contents = []
    for response in fs.read_entire_directory(connection, credentials, 5000,
                                             path):
        contents = contents + [(f['name'], f['type'])
                               for f in response.data['files']]

    return create_json_list(path, contents)


@main.route('/', methods=['GET'])
def index():
    return render_template('index.html')


@main.route('/upload-target', methods=['POST'])
def upload_file():

    file = request.files['file']
コード例 #7
0
ファイル: qacls_push.py プロジェクト: Qumulo/qacls
 def fs_read_dir(self, path):
     """wrapper for fs.read_entire_directory()"""
     return fs.read_entire_directory(self.connection, self.credentials, page_size=5000, path=path)
コード例 #8
0
ファイル: views.py プロジェクト: Qumulo/file_transfer_tool
        connection = qumulo.lib.request.Connection(\
                            host, port)
        login_results, _ = qumulo.rest.auth.login(\
                connection, None, user, passwd)

        credentials = qumulo.lib.auth.Credentials.\
                from_login_response(login_results)

    except Exception, excpt:
        print "Error connecting to the REST server: %s" % excpt
        print __doc__
        # TODO: Raise error
        return False

    contents = []
    for response in fs.read_entire_directory(connection, credentials, 5000, path):
        contents = contents + [ (f['name'], f['type']) for f in response.data['files']]

    return create_json_list(path, contents)


@main.route('/', methods=['GET'])
def index():
    return render_template('index.html')

@main.route('/upload-target', methods=['POST'])
def upload_file():

    file = request.files['file']

    if file: