Example #1
0
    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)
Example #2
0
    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)
Example #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
Example #4
0
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
Example #5
0
 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/')
Example #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']
Example #7
0
 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)
Example #8
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']

    if file: